Skip to content

Commit 13fced7

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 93aa776 commit 13fced7

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
@@ -622,7 +622,7 @@ impl Extension {
622622
}
623623

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

0 commit comments

Comments
 (0)