Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
network: don't force send block announcements (#7601)
Browse files Browse the repository at this point in the history
  • Loading branch information
andresilva authored Nov 27, 2020
1 parent d428fc7 commit ca62de0
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions client/network/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1083,16 +1083,11 @@ impl<B: BlockT, H: ExHashT> Protocol<B, H> {

let is_best = self.context_data.chain.info().best_hash == hash;
debug!(target: "sync", "Reannouncing block {:?} is_best: {}", hash, is_best);
self.send_announcement(&header, data, is_best, true)
}

fn send_announcement(&mut self, header: &B::Header, data: Vec<u8>, is_best: bool, force: bool) {
let hash = header.hash();

for (who, ref mut peer) in self.context_data.peers.iter_mut() {
trace!(target: "sync", "Announcing block {:?} to {}", hash, who);
let inserted = peer.known_blocks.insert(hash);
if inserted || force {
if inserted {
trace!(target: "sync", "Announcing block {:?} to {}", hash, who);
let message = message::BlockAnnounce {
header: header.clone(),
state: if is_best {
Expand Down

0 comments on commit ca62de0

Please sign in to comment.