Make Script::witness_version public

This commit is contained in:
Dr Maxim Orlovsky 2022-03-13 14:40:03 +01:00
parent 93daed95bd
commit 7554d76dfe
No known key found for this signature in database
GPG Key ID: FFC0250947E5C6F7
1 changed files with 2 additions and 1 deletions

View File

@ -410,8 +410,9 @@ impl Script {
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]
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())
}