Skip to main content

connect_block_with_chainwork

Function connect_block_with_chainwork 

Source
pub fn connect_block_with_chainwork(
    block: &Block,
    witnesses: &[Vec<Vec<Vec<u8>>>],
    utxo_set: HashMap<OutPoint, Arc<UTXO>, FxBuildHasher>,
    height: u64,
    context: &BlockValidationContext,
    best_header_chainwork: Option<U256>,
) -> Result<(ValidationResult, HashMap<OutPoint, Arc<UTXO>, FxBuildHasher>, BlockUndoLog), ConsensusError>
Expand description

ConnectBlock with explicit chainwork for assume-valid gating. Non-IBD mode: the returned UtxoSet is fully updated (outputs added, inputs removed) just like connect_block. The only difference from connect_block is that best_header_chainwork is forwarded to the assume-valid gate so scripts are skipped when height < assume_valid_height.

Use this instead of connect_block_ibd when the caller needs to apply the returned UtxoSet to persistent storage — connect_block_ibd sets ibd_mode=true which skips UTXO mutations on the returned set.