未验证 提交 6016c1e2 编写于 作者: G Greg Lee 提交者: GitHub

Merge pull request #2033 from EOSIO/missed-blocks-2

Log number of missed blocks - #1987
......@@ -198,6 +198,18 @@ bool chain_controller::_push_block(const signed_block& new_block)
// push all blocks on the new fork
for (auto ritr = branches.first.rbegin(); ritr != branches.first.rend(); ++ritr) {
ilog("pushing blocks from fork ${n} ${id}", ("n",(*ritr)->data.block_num())("id",(*ritr)->data.id()));
{
uint32_t delta = 0;
if (ritr != branches.first.rbegin()) {
delta = (*ritr)->data.timestamp.slot - (*std::prev(ritr))->data.timestamp.slot;
} else {
optional<signed_block> prev = fetch_block_by_id((*ritr)->data.previous);
if (prev)
delta = (*ritr)->data.timestamp.slot - prev->timestamp.slot;
}
if (delta > 1)
wlog("Number of missed blocks: ${num}", ("num", delta-1));
}
optional<fc::exception> except;
try {
auto session = _db.start_undo_session(true);
......
......@@ -73,6 +73,9 @@ void fork_database::_push_block(const item_ptr& item)
if( !_head ) _head = item;
else if( item->num > _head->num )
{
uint32_t delta = item->data.timestamp.slot - _head->data.timestamp.slot;
if (delta > 1)
wlog("Number of missed blocks: ${num}", ("num", delta-1));
_head = item;
uint32_t min_num = _head->num - std::min( _max_size, _head->num );
// ilog( "min block in fork DB ${n}, max_size: ${m}", ("n",min_num)("m",_max_size) );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册