4 #include <boost/multi_index_container.hpp>
5 #include <boost/multi_index/member.hpp>
6 #include <boost/multi_index/ordered_index.hpp>
7 #include <boost/multi_index/hashed_index.hpp>
8 #include <boost/multi_index/mem_fun.hpp>
12 using boost::multi_index_container;
13 using namespace boost::multi_index;
32 std::weak_ptr<fork_item>
prev;
59 const static int MAX_BLOCK_REORDERING = 1024;
66 void set_head(std::shared_ptr<fork_item> h);
68 std::shared_ptr<fork_item> fetch_block(
const block_id_type&
id)
const;
69 std::vector<item_ptr> fetch_block_by_number(uint32_t n)
const;
74 std::shared_ptr<fork_item> push_block(
const signed_block& b);
75 std::shared_ptr<fork_item>
head()
const
86 std::shared_ptr<fork_item> walk_main_branch_to_num(uint32_t block_num)
const;
87 std::shared_ptr<fork_item> fetch_block_on_main_branch_by_number(uint32_t block_num)
const;
92 typedef multi_index_container<
item_ptr,
93 indexed_by<hashed_unique<tag<block_id>,
94 member<fork_item, block_id_type, &fork_item::id>,
95 std::hash<fc::ripemd160>>,
96 hashed_non_unique<tag<by_previous>,
100 std::hash<fc::ripemd160>>,
101 ordered_non_unique<tag<block_num>,
102 member<fork_item, uint32_t, &fork_item::num>>>>
105 void set_max_size(uint32_t s);
109 void _push_block(
const item_ptr& b);
110 void _push_next(
const item_ptr& newly_inserted);
112 uint32_t _max_size = 1024;
116 std::shared_ptr<fork_item> _head;
std::vector< item_ptr > branch_type
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 > >, hashed_non_unique< tag< by_previous >, const_mem_fun< fork_item, block_id_type, &fork_item::previous_id >, std::hash< fc::ripemd160 > >, ordered_non_unique< tag< block_num >, member< fork_item, uint32_t, &fork_item::num > > > > fork_multi_index_type
std::shared_ptr< fork_item > head() const
void remove(db_index &db_idx, const TObject &o)
std::shared_ptr< fork_item > item_ptr
fc::ripemd160 block_id_type
block_id_type previous_id() const
fork_item(signed_block d)
std::weak_ptr< fork_item > prev