pub fn validate_witness_commitment(
coinbase_tx: &Transaction,
witness_merkle_root: &[u8; 32],
coinbase_witnesses: &[Vec<Vec<u8>>],
) -> Result<bool, ConsensusError>Expand description
Validate witness commitment in coinbase transaction.
Per BIP141, the commitment recorded in the coinbase OP_RETURN is:
commitment = sha256d(witness_merkle_root || coinbase_reserved_nonce)
where coinbase_reserved_nonce is the 32-byte nonce stored in
the coinbase input’s witness stack (witnesses[0][0]).
If the coinbase has no witness, the reserved value is 32 zero bytes.
The OP_RETURN output format is: OP_RETURN 0x24 0xaa21a9ed <commitment_hash:32>