bool block_chain_impl::pop_from(block_detail::list& out_blocks,
    uint64_t height)
{
    size_t top;
    if (!database_.blocks.top(top))
        return false;

    for (uint64_t index = top; index >= height; --index)
    {
        const auto block = std::make_shared<block_detail>(database_.pop());
        out_blocks.push_back(block);
    }

    return true;
}
示例#2
0
bool simple_chain_impl::release(uint64_t begin_index,
                                block_detail::list& released_blocks)
{
    size_t last_height;
    if (!database_.blocks.top(last_height))
        return false;

    for (uint64_t height = last_height; height >= begin_index; --height)
    {
        const auto block = std::make_shared<block_detail>(database_.pop());
        released_blocks.push_back(block);
    }

    return true;
}