Ejemplo n.º 1
0
code data_base::verify_insert(const block& block, size_t height)
{
    if (block.transactions().empty())
        return error::empty_block;

    if (blocks_->exists(height))
        return error::store_block_duplicate;

    return error::success;
}
Ejemplo n.º 2
0
code data_base::verify_push(const block& block, size_t height)
{
    if (block.transactions().empty())
        return error::empty_block;

    if (get_next_height(blocks()) != height)
        return error::store_block_invalid_height;

    if (block.header().previous_block_hash() !=
        get_previous_hash(blocks(), height))
        return error::store_block_missing_parent;

    return error::success;
}