pub fn pop_block(
move_to_alt_chain: Option<ChainId>,
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.
If a ChainId
is specified the popped block will be added to the alt block tables under
that ChainId
. Otherwise, the block will be completely removed from the DB.
§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.