Merge rust-bitcoin/rust-bitcoin#876: Make Script::witness_version public
7554d76dfe
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: ACK7554d76dfe
sanket1729: utACK7554d76dfe
. I also found needing this rust-miniscript and had to some work-around. Tree-SHA512: 27ae8fbbb5f19d7b3553fb05f193488c4096aa0e4949a5cdd96b9fda89f1983e45855598c4507131848e0ff2086a5b91b2201e9aed3ed8fcb66034a36715a434
This commit is contained in:
commit
efa9555ebd
|
@ -410,8 +410,9 @@ impl Script {
|
||||||
Script::new_v1_p2tr(&secp, internal_key, Some(merkle_root))
|
Script::new_v1_p2tr(&secp, internal_key, Some(merkle_root))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns witness version of the script, if any, assuming the script is a `scriptPubkey`.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn witness_version(&self) -> Option<WitnessVersion> {
|
pub fn witness_version(&self) -> Option<WitnessVersion> {
|
||||||
self.0.get(0).and_then(|opcode| WitnessVersion::from_opcode(opcodes::All::from(*opcode)).ok())
|
self.0.get(0).and_then(|opcode| WitnessVersion::from_opcode(opcodes::All::from(*opcode)).ok())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue