| 1433 | } |
| 1434 | |
| 1435 | void ClientImpl::blocks_too_old_monitor_task() { |
| 1436 | // if we have no connections, don't warn about the head block too old -- |
| 1437 | // we should already be warning about no connections |
| 1438 | // if we're syncing, don't warn, we wouldn't be syncing if the head block weren't old |
| 1439 | if (_chain_db->get_head_block().timestamp < thinkyoung::blockchain::now() - fc::seconds(ALP_BLOCKCHAIN_BLOCK_INTERVAL_SEC * 2) && |
| 1440 | !_sync_mode && |
| 1441 | _p2p_node->get_connection_count() > 0 && |
| 1442 | _notifier) |
| 1443 | _notifier->notify_head_block_too_old(_chain_db->get_head_block().timestamp); |
| 1444 | |
| 1445 | if (!_blocks_too_old_monitor_done.canceled()) |
| 1446 | _blocks_too_old_monitor_done = fc::schedule([=]() { |
| 1447 | blocks_too_old_monitor_task(); |
| 1448 | }, |
| 1449 | fc::time_point::now() + fc::seconds(ALP_BLOCKCHAIN_BLOCK_INTERVAL_SEC), |
| 1450 | "block_monitor_task"); |
| 1451 | } |
| 1452 | |
| 1453 | void ClientImpl::cancel_blocks_too_old_monitor_task() { |
| 1454 | try { |
no test coverage detected