Skip to content

Commit 341983b

Browse files
committed
Fix to receive peer requests from just connected nodes
All `self.header_downloaders.keys()` are in `connected_nodes`, and `self.header_downloaders` keep tracks of nodes which have sent at least one peer status out of connected nodes. The following commit will prohibit the node sending peer requests before it finishes to snapshot sync, so it can send peer requests before share peer status. So this changes make the node accept requests from the node who didn't send any peer status.
1 parent 9379782 commit 341983b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sync/src/block/extension.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ impl Extension {
626626
}
627627

628628
fn on_peer_request(&self, from: &NodeId, id: u64, request: RequestMessage) {
629-
if !self.header_downloaders.contains_key(from) {
629+
if !self.connected_nodes.contains(from) {
630630
cinfo!(SYNC, "Request from invalid peer #{} received", from);
631631
return
632632
}

0 commit comments

Comments
 (0)