fuzz: factor chanmon broadcast relay helper
What changed, and why it matters
This is a minor code cleanup inside a fuzzing test harness. It extracts a small loop that collects broadcast transactions from all simulated nodes into a new helper function, then calls that helper from an existing cleanup loop. The actual behavior is unchanged; only duplicated code is removed.
No security action needed. Treat as routine refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit refactors fuzz/src/chanmon_consistency.rs by introducing relay_all_broadcasts(), which drains txn_broadcasted from every node’s broadcaster and relays them via self.chain_state.relay_transactions(txs). The existing mine_relayed_txs_until_quiet() loop now calls this helper instead of inlining the same logic. No functional changes are made to transaction relaying or mining logic.
Changed components
fuzz/src/chanmon_consistency.rstest/fuzzing harness onlyInspect captured patch +9 / −5
diff --git a/fuzz/src/chanmon_consistency.rs b/fuzz/src/chanmon_consistency.rs
index 8d16a78..f288d4a 100644
--- a/fuzz/src/chanmon_consistency.rs
+++ b/fuzz/src/chanmon_consistency.rs
@@ -3652,6 +3652,14 @@ impl<'a, Out: Output + MaybeSend + MaybeSync> Harness<'a, Out> {
self.chain_state.relay_transactions(txs);
}
+ fn relay_all_broadcasts(&mut self) {
+ let mut txs = Vec::new();
+ for node in &self.nodes {
+ txs.extend(node.broadcaster.txn_broadcasted.borrow_mut().drain(..));
+ }
+ self.chain_state.relay_transactions(txs);
+ }
+
fn earliest_pending_htlc_expiry(&self) -> Option<u32> {
let mut earliest_expiry: Option<u32> = None;
for node in &self.nodes {
@@ -3738,11 +3746,7 @@ impl<'a, Out: Output + MaybeSend + MaybeSync> Harness<'a, Out> {
fn mine_relayed_txs_until_quiet(&mut self) {
for _ in 0..MAX_FINISH_RELAY_MINE_ROUNDS {
- let mut txs = Vec::new();
- for node in &self.nodes {
- txs.extend(node.broadcaster.txn_broadcasted.borrow_mut().drain(..));
- }
- self.chain_state.relay_transactions(txs);
+ self.relay_all_broadcasts();
if self.chain_state.pending_txs.is_empty() {
return;
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.