|
BitShares-Core
7.0.2
BitShares blockchain node software and command-line wallet software
|
#include <fork_database.hpp>
Public Types | |
| typedef vector< item_ptr > | branch_type |
| typedef multi_index_container< item_ptr, indexed_by< hashed_unique< tag< block_id >, member< fork_item, block_id_type, &fork_item::id >, std::hash< fc::ripemd160 > >, ordered_non_unique< tag< block_num >, member< fork_item, uint32_t,&fork_item::num > > > > | fork_multi_index_type |
Public Member Functions | |
| fork_database () | |
| void | reset () |
| void | start_block (signed_block b) |
| void | remove (block_id_type b) |
| void | set_head (shared_ptr< fork_item > h) |
| bool | is_known_block (const block_id_type &id) const |
| shared_ptr< fork_item > | fetch_block (const block_id_type &id) const |
| vector< item_ptr > | fetch_block_by_number (uint32_t n) const |
| shared_ptr< fork_item > | push_block (const signed_block &b) |
| shared_ptr< fork_item > | head () const |
| void | pop_block () |
| pair< branch_type, branch_type > | fetch_branch_from (block_id_type first, block_id_type second) const |
| void | set_max_size (uint32_t s) |
Static Public Attributes | |
| const static int | MAX_BLOCK_REORDERING = 1024 |
| The maximum number of blocks that may be skipped in an out-of-order push. More... | |
As long as blocks are pushed in order the fork database will maintain a linked tree of all blocks that branch from the start_block. The tree will have a maximum depth of 1024 blocks after which the database will start lopping off forks.
Every time a block is pushed into the fork DB the block with the highest block_num will be returned.
Definition at line 70 of file fork_database.hpp.
| typedef vector<item_ptr> graphene::chain::fork_database::branch_type |
Definition at line 73 of file fork_database.hpp.
| typedef multi_index_container< item_ptr, indexed_by< hashed_unique<tag<block_id>, member<fork_item, block_id_type, &fork_item::id>, std::hash<fc::ripemd160> >, ordered_non_unique<tag<block_num>, member<fork_item,uint32_t,&fork_item::num> > > > graphene::chain::fork_database::fork_multi_index_type |
Definition at line 102 of file fork_database.hpp.
| graphene::chain::fork_database::fork_database | ( | ) |
Definition at line 28 of file fork_database.cpp.
| item_ptr graphene::chain::fork_database::fetch_block | ( | const block_id_type & | id | ) | const |
Definition at line 124 of file fork_database.cpp.
| vector< item_ptr > graphene::chain::fork_database::fetch_block_by_number | ( | uint32_t | n | ) | const |
Definition at line 133 of file fork_database.cpp.
| pair< fork_database::branch_type, fork_database::branch_type > graphene::chain::fork_database::fetch_branch_from | ( | block_id_type | first, |
| block_id_type | second | ||
| ) | const |
Given two head blocks, return two branches of the fork graph that end with a common ancestor (same prior block)
Definition at line 149 of file fork_database.cpp.
|
inline |
Definition at line 91 of file fork_database.hpp.
| bool graphene::chain::fork_database::is_known_block | ( | const block_id_type & | id | ) | const |
Definition at line 117 of file fork_database.cpp.
| void graphene::chain::fork_database::pop_block | ( | ) |
Definition at line 37 of file fork_database.cpp.
| shared_ptr< fork_item > graphene::chain::fork_database::push_block | ( | const signed_block & | b | ) |
Pushes the block into the fork database
Definition at line 56 of file fork_database.cpp.
| void graphene::chain::fork_database::remove | ( | block_id_type | b | ) |
Definition at line 197 of file fork_database.cpp.
| void graphene::chain::fork_database::reset | ( | ) |
Definition at line 31 of file fork_database.cpp.
| void graphene::chain::fork_database::set_head | ( | shared_ptr< fork_item > | h | ) |
Definition at line 192 of file fork_database.cpp.
| void graphene::chain::fork_database::set_max_size | ( | uint32_t | s | ) |
Definition at line 100 of file fork_database.cpp.
| void graphene::chain::fork_database::start_block | ( | signed_block | b | ) |
Definition at line 45 of file fork_database.cpp.
|
static |
The maximum number of blocks that may be skipped in an out-of-order push.
Definition at line 75 of file fork_database.hpp.
1.8.17