Skip to content

Commit 10034f8

Browse files
author
ChallengeDev210
committed
Merge rust-bitcoin/rust-bitcoin#876: Make Script::witness_version public
7554d76 Make Script::witness_version public (Dr Maxim Orlovsky) Pull request description: Originally this function was public (at least I was using it in downstream dependency in https://github.com/LNP-BP/descriptor-wallet). Now, in RC1, it became private. It is quite useful to detect witness scriptPubkeys. ACKs for top commit: apoelstra: ACK 7554d76 sanket1729: utACK 7554d76. I also found needing this rust-miniscript and had to some work-around. Tree-SHA512: 27ae8fbbb5f19d7b3553fb05f193488c4096aa0e4949a5cdd96b9fda89f1983e45855598c4507131848e0ff2086a5b91b2201e9aed3ed8fcb66034a36715a434
2 parents 8656cda + 8cdbf75 commit 10034f8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/blockdata/script.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,9 @@ impl Script {
410410
Script::new_v1_p2tr(&secp, internal_key, Some(merkle_root))
411411
}
412412

413+
/// Returns witness version of the script, if any, assuming the script is a `scriptPubkey`.
413414
#[inline]
414-
fn witness_version(&self) -> Option<WitnessVersion> {
415+
pub fn witness_version(&self) -> Option<WitnessVersion> {
415416
self.0.get(0).and_then(|opcode| WitnessVersion::from_opcode(opcodes::All::from(*opcode)).ok())
416417
}
417418

0 commit comments

Comments
 (0)