witness: Add Witness::witness_script inspector
This commit is contained in:
parent
6cc6c8621a
commit
ac4db6369d
|
@ -450,6 +450,15 @@ impl Witness {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the p2wsh witness script following BIP141 rules.
|
||||||
|
///
|
||||||
|
/// This does not guarantee that this represents a P2WS [`Witness`]. See
|
||||||
|
/// [Script::is_p2wsh](crate::blockdata::script::Script::is_p2wsh) to
|
||||||
|
/// check whether this is actually a P2WSH witness.
|
||||||
|
pub fn witness_script(&self) -> Option<&Script> {
|
||||||
|
self.last().map(Script::from_bytes)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Index<usize> for Witness {
|
impl Index<usize> for Witness {
|
||||||
|
|
Loading…
Reference in New Issue