Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unavailable item from active sync requests, fix node stuck issue #2445

Merged
merged 2 commits into from
May 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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