cuprated::blockchain::interface

Function handle_incoming_block

Source
pub async fn handle_incoming_block(
    block: Block,
    given_txs: HashMap<[u8; 32], Transaction>,
    blockchain_read_handle: &mut BlockchainReadHandle,
    txpool_read_handle: &mut TxpoolReadHandle,
) -> Result<IncomingBlockOk, IncomingBlockError>
Expand description

Try to add a new block to the blockchain.

On success returns IncomingBlockOk.

§Errors

This function will return an error if:

  • the block was invalid
  • we are missing transactions
  • the block’s parent is unknown