MCPcopy Create free account
hub / github.com/cryptonomex/graphene / push_block

Method push_block

libraries/chain/fork_database.cpp:52–66  ·  view source on GitHub ↗

* Pushes the block into the fork database and caches it if it doesn't link * */

Source from the content-addressed store, hash-verified

50 *
51 */
52shared_ptr<fork_item> fork_database::push_block(const signed_block& b)
53{
54 auto item = std::make_shared<fork_item>(b);
55 try {
56 _push_block(item);
57 }
58 catch ( const unlinkable_block_exception& e )
59 {
60 wlog( "Pushing block to fork database that failed to link: ${id}, ${num}", ("id",b.id())("num",b.block_num()) );
61 wlog( "Head: ${num}, ${id}", ("num",_head->data.block_num())("id",_head->data.id()) );
62 throw;
63 _unlinked_index.insert( item );
64 }
65 return _head;
66}
67
68void fork_database::_push_block(const item_ptr& item)
69{

Callers

nothing calls this directly

Calls 3

_push_blockFunction · 0.85
block_numMethod · 0.80
idMethod · 0.45

Tested by

no test coverage detected