From d942882b3602d1e09a3edb691b8c0a759910b754 Mon Sep 17 00:00:00 2001 From: Peter Ryszkiewicz <3519085+pRizz@users.noreply.github.com> Date: Mon, 16 Sep 2024 21:02:29 -0500 Subject: [PATCH] Document the magic bytes for witness commitment --- bitcoin/src/blockdata/block.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/bitcoin/src/blockdata/block.rs b/bitcoin/src/blockdata/block.rs index 1670389d4..6c6e73622 100644 --- a/bitcoin/src/blockdata/block.rs +++ b/bitcoin/src/blockdata/block.rs @@ -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())) {