pub fn create_new_block(
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>,
) -> Result<Block, ConsensusError>Expand description
CreateNewBlock: 𝒰𝒮 × 𝒯𝒳* → ℬ
For UTXO set us and mempool transactions txs:
- Create coinbase transaction with appropriate subsidy
- Select transactions from mempool based on fee rate
- Calculate merkle root
- Create block header with appropriate difficulty
- Return new block