Skip to main content

create_new_block

Function create_new_block 

Source
pub fn create_new_block(
    utxo_set: &UtxoSet,
    mempool_txs: &[Transaction],
    height: Natural,
    prev_header: &BlockHeader,
    prev_headers: &[BlockHeader],
    coinbase_script: &ByteString,
    coinbase_address: &ByteString,
) -> Result<Block>
Expand description

CreateNewBlock: 𝒰𝒮 × 𝒯𝒳* → ℬ

For UTXO set us and mempool transactions txs:

  1. Create coinbase transaction with appropriate subsidy
  2. Select transactions from mempool based on fee rate
  3. Calculate merkle root
  4. Create block header with appropriate difficulty
  5. Return new block