Skip to content

Commit 7dc3178

Browse files
committed
Updates block hash gossip task to avoid waiting on broadcast all requests
1 parent 1c74652 commit 7dc3178

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

zebrad/src/components/sync/gossip.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,16 @@ where
127127
};
128128

129129
info!(?height, ?request, log_msg);
130-
// broadcast requests don't return errors, and we'd just want to ignore them anyway
131-
let _ = broadcast_network
130+
let broadcast_fut = broadcast_network
132131
.ready()
133132
.await
134133
.map_err(PeerSetReadiness)?
135-
.call(request)
136-
.await;
134+
.call(request);
135+
136+
// Await the broadcast future in a spawned task to avoid waiting on
137+
// `AdvertiseBlockToAll` requests when there are unready peers.
138+
// Broadcast requests don't return errors, and we'd just want to ignore them anyway.
139+
tokio::spawn(broadcast_fut);
137140

138141
// Mark the last change hash of `chain_state` as the last block submission hash to avoid
139142
// advertising a block hash to some peers twice.

0 commit comments

Comments
 (0)