diff --git a/zebrad/src/commands/start/sync.rs b/zebrad/src/commands/start/sync.rs index 866fcafd..6f0413f9 100644 --- a/zebrad/src/commands/start/sync.rs +++ b/zebrad/src/commands/start/sync.rs @@ -226,8 +226,13 @@ where continue; }; + // Make sure we get the same tips, regardless of the + // order of peer responses if !download_set.contains(&new_tip.expected_next) { - tracing::debug!(?new_tip, "adding new prospective tip"); + tracing::debug!(?new_tip, + "adding new prospective tip, and removing existing tips in the new block hash list"); + self.prospective_tips + .retain(|t| !unknown_hashes.contains(&t.expected_next)); self.prospective_tips.insert(new_tip); } else { tracing::debug!(?new_tip, "discarding tip already queued for download"); @@ -305,8 +310,13 @@ where tracing::trace!(?hashes); + // Make sure we get the same tips, regardless of the + // order of peer responses if !download_set.contains(&new_tip.expected_next) { - tracing::debug!(?new_tip, "adding new prospective tip"); + tracing::debug!(?new_tip, + "adding new prospective tip, and removing any existing tips in the new block hash list"); + self.prospective_tips + .retain(|t| !unknown_hashes.contains(&t.expected_next)); self.prospective_tips.insert(new_tip); } else { tracing::debug!(?new_tip, "discarding tip already queued for download");