Skip to main content

compute_sighashes_batch

Function compute_sighashes_batch 

Source
pub fn compute_sighashes_batch(
    tx: &Transaction,
    script_codes: &[&[u8]],
    sighash_bytes: &[u8],
) -> Vec<[u8; 32]>
Expand description

Batch-compute legacy sighashes for all inputs of a single transaction using SHA256 forward midstate caching. For SIGHASH_ALL (most common), the SHA256 state after processing inputs 0..i-1 with blank scripts is reused for input i, cutting the O(N²) hashing work roughly in half.

Falls back to per-input compute for ANYONECANPAY/SINGLE/NONE hash types.