Merge rust-bitcoin/rust-bitcoin#3370: Document the magic bytes for witness commitment

d942882b36 Document the magic bytes for witness commitment (Peter Ryszkiewicz)

Pull request description:

ACKs for top commit:
  apoelstra:
    ACK d942882b36 successfully ran local tests; neat! I don't think I was aware of this
  tcharding:
    ACK d942882b36

Tree-SHA512: 89766e986574e49b6c5fd00844db679eb8894a591463029f7f88079fa9ca65bd56265a42dd8fa5aad20ef4744bca3259c06f8a461abd1c695fb89433ed5cc145
This commit is contained in:
merge-script 2024-09-17 22:20:41 +00:00
commit 1319c65506
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 1 additions and 0 deletions

View File

@ -245,6 +245,7 @@ impl Block {
/// Checks if witness commitment in coinbase matches the transaction list.
pub fn check_witness_commitment(&self) -> bool {
// Consists of OP_RETURN, OP_PUSHBYTES_36, and four "witness header" bytes.
const MAGIC: [u8; 6] = [0x6a, 0x24, 0xaa, 0x21, 0xa9, 0xed];
// Witness commitment is optional if there are no transactions using SegWit in the block.
if self.txdata.iter().all(|t| t.input.iter().all(|i| i.witness.is_empty())) {