* Pushes the block into the fork database and caches it if it doesn't link * */
| 50 | * |
| 51 | */ |
| 52 | shared_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 | |
| 68 | void fork_database::_push_block(const item_ptr& item) |
| 69 | { |
nothing calls this directly
no test coverage detected