Merge rust-bitcoin/rust-bitcoin#1483: Mention Script::is_v1_p2tr above Witness::tapscript

67ca3463c0 Mention Script::is_v1_p2tr above Witness::tapscript (Casey Rodarmor)

Pull request description:

  It seems useful to document that this check is also provided.

ACKs for top commit:
  tcharding:
    ACK 67ca3463c0
  Kixunil:
    ACK 67ca3463c0
  apoelstra:
    ACK 67ca3463c0

Tree-SHA512: b36ff89cd7bb4ffe48e1bc4fcbfe35116492f5b0f9fbce271abd83f266fdcb25f7faa459acc35f944c4bdfa2626c00c194400a11f32ad84a323a07bfa5ec1b0a
This commit is contained in:
Andrew Poelstra 2022-12-19 18:54:31 +00:00
commit 8cbecf0209
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 5 additions and 3 deletions

View File

@ -312,9 +312,11 @@ impl Witness {
/// Get Tapscript following BIP341 rules regarding accounting for an annex. /// Get Tapscript following BIP341 rules regarding accounting for an annex.
/// ///
/// This does not guarantee that this represents a P2TR [`Witness`]. /// This does not guarantee that this represents a P2TR [`Witness`]. It
/// It merely gets the second to last or third to last element depending /// merely gets the second to last or third to last element depending on
/// on the first byte of the last element being equal to 0x50. /// the first byte of the last element being equal to 0x50. See
/// [Script::is_v1_p2tr](crate::blockdata::script::Script::is_v1_p2tr) to
/// check whether this is actually a Taproot witness.
pub fn tapscript(&self) -> Option<&[u8]> { pub fn tapscript(&self) -> Option<&[u8]> {
let len = self.len(); let len = self.len();
self self