@@ -170,6 +170,11 @@ void protocol_block_out::handle_fetch_locator_headers(const code& ec,
170170 if (message->elements ().empty ())
171171 return ;
172172
173+
174+ // Allow a peer to sync despite our being stale.
175+ // //if (chain_.is_stale())
176+ // // return;
177+
173178 // Respond to get_headers with headers.
174179 SEND2 (*message, handle_send, _1, message->command );
175180
@@ -205,6 +210,10 @@ bool protocol_block_out::handle_receive_get_blocks(const code& ec,
205210 return true ;
206211 }
207212
213+ // Allow a peer to sync despite our being stale.
214+ // //if (chain_.is_stale())
215+ // // return true;
216+
208217 const auto threshold = last_locator_top_.load ();
209218
210219 chain_.fetch_locator_block_hashes (message, threshold, max_get_blocks,
@@ -230,6 +239,10 @@ void protocol_block_out::handle_fetch_locator_hashes(const code& ec,
230239 if (message->inventories ().empty ())
231240 return ;
232241
242+ // Allow a peer to sync despite our being stale.
243+ // //if (chain_.is_stale())
244+ // // return;
245+
233246 // Respond to get_blocks with inventory.
234247 SEND2 (*message, handle_send, _1, message->command );
235248
@@ -248,6 +261,7 @@ bool protocol_block_out::handle_receive_get_data(const code& ec,
248261 if (stopped (ec))
249262 return false ;
250263
264+ // TODO: consider rejecting the message for duplicated entries.
251265 if (message->inventories ().size () > max_get_data)
252266 {
253267 LOG_WARNING (LOG_NODE)
@@ -257,6 +271,10 @@ bool protocol_block_out::handle_receive_get_data(const code& ec,
257271 return false ;
258272 }
259273
274+ // Allow a peer to sync despite our being stale.
275+ // //if (chain_.is_stale())
276+ // // return true;
277+
260278 // Create a copy because message is const because it is shared.
261279 const auto & inventories = message->inventories ();
262280 const auto response = std::make_shared<inventory>();
0 commit comments