Skip to content

Commit

Permalink
Merge pull request #2445 from bitshares/fix-node-sync
Browse files Browse the repository at this point in the history
Remove unavailable item from active sync requests, fix node stuck issue
  • Loading branch information
abitmore authored May 3, 2021
2 parents efecf9a + ba707b3 commit b52e5e6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libraries/net/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1610,7 +1610,7 @@ namespace graphene { namespace net { namespace detail {
originating_peer->send_message(address_request_message());
fc::time_point now = fc::time_point::now();
if (_is_firewalled == firewalled_state::unknown &&
_last_firewall_check_message_sent < now - fc::minutes(5) &&
_last_firewall_check_message_sent < (now - fc::minutes(5)) &&
originating_peer->core_protocol_version >= 106)
{
wlog("I don't know if I'm firewalled. Sending a firewall check message to peer ${peer}",
Expand Down Expand Up @@ -2169,7 +2169,7 @@ namespace graphene { namespace net { namespace detail {
originating_peer->last_block_time_delegate_has_seen + // timestamp of the block immediately before the first unfetched block
originating_peer->number_of_unfetched_item_ids * GRAPHENE_MIN_BLOCK_INTERVAL;
fc::time_point_sec now = fc::time_point::now();
if (minimum_time_of_last_offered_block > now + GRAPHENE_NET_FUTURE_SYNC_BLOCKS_GRACE_PERIOD_SEC)
if (minimum_time_of_last_offered_block > (now + GRAPHENE_NET_FUTURE_SYNC_BLOCKS_GRACE_PERIOD_SEC))
{
wlog("Disconnecting from peer ${peer} who offered us an implausible number of blocks, their last block would be in the future (${timestamp})",
("peer", originating_peer->get_remote_endpoint())
Expand Down Expand Up @@ -2359,6 +2359,7 @@ namespace graphene { namespace net { namespace detail {
auto sync_item_iter = originating_peer->sync_items_requested_from_peer.find(requested_item.item_hash);
if (sync_item_iter != originating_peer->sync_items_requested_from_peer.end())
{
_active_sync_requests.erase(*sync_item_iter);
originating_peer->sync_items_requested_from_peer.erase(sync_item_iter);

if (originating_peer->peer_needs_sync_items_from_us)
Expand Down

0 comments on commit b52e5e6

Please sign in to comment.