Skip to main content

create_new_block_with_time

Function create_new_block_with_time 

Source
pub fn create_new_block_with_time(
    utxo_set: &HashMap<OutPoint, Arc<UTXO>, FxBuildHasher>,
    mempool_txs: &[Transaction],
    height: u64,
    prev_header: &BlockHeader,
    prev_headers: &[BlockHeader],
    coinbase_script: &Vec<u8>,
    coinbase_address: &Vec<u8>,
    block_time: u64,
) -> Result<Block, ConsensusError>
Expand description

CreateNewBlock variant that accepts an explicit block_time.

This allows callers (e.g., node layer) to provide a median time-past or adjusted network time instead of relying on SystemTime::now() inside consensus code.