Function cuprate_blockchain::ops::block::pop_block

source ·
pub fn pop_block(
    tables: &mut impl TablesMut,
) -> Result<(BlockHeight, BlockHash, Block), RuntimeError>
Expand description

Remove the top/latest block from the database.

The removed block’s data is returned.

§Errors

This function returns RuntimeError::KeyNotFound if the input (if applicable) doesn’t exist or other RuntimeError’s on database errors.

In pop_block()’s case, RuntimeError::KeyNotFound will be returned if there are no blocks left.