Functions§
- calculate_
block_ weight - Calculate block weight for SegWit blocks
- calculate_
block_ weight_ from_ nested - Calculate block weight from nested witnesses without flattening.
- calculate_
transaction_ weight - Calculate transaction weight for SegWit BIP141: Weight(tx) = 3 × BaseSize(tx) + TotalSize(tx)
- compute_
witness_ merkle_ root - Compute witness merkle root for block (legacy flat witness layout).
- compute_
witness_ merkle_ root_ from_ nested - Compute witness merkle root from nested witnesses without flattening.
Accepts
&[Vec<Witness>]where eachVec<Witness>is one tx’s input stacks. Avoids allocating flattened structure in block validation hot path. Orange Paper 11.1.4: WitnessRoot = ComputeMerkleRoot({wtxid : tx ∈ block.transactions}) - is_
segwit_ transaction - Check if transaction is SegWit (v0) or Taproot (v1) based on outputs
- transaction_
weight_ from_ stacks - Weight of one transaction:
3 × stripped size + total size. - validate_
segwit_ block - Validate SegWit block
- validate_
witness_ commitment - Validate witness commitment in coinbase transaction.
- witness_
commitment_ script - BIP141 coinbase OP_RETURN:
OP_RETURN 0x24 0xaa21a9ed || sha256d(root || nonce).
Type Aliases§
- Witness
- Witness Data: 𝒲 = 𝕊* (stack of witness elements)