fuzz: inline chanmon finish invariants
What changed, and why it matters
This commit is a minor internal refactoring of a fuzz test file. It moves a small helper function's contents directly into the place where it was called, changing a loop over three hard-coded nodes into a generic loop. There is no change to production code, no change to security behavior, and no fix for a vulnerability.
No action required. This is a non-security refactoring of test/fuzz infrastructure.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit removes the assert_test_invariants helper in fuzz/src/chanmon_consistency.rs and inlines its assertions into Harness::finish. The assertions remain identical: they verify that three test nodes have the expected number of channels and that no transactions were unexpectedly broadcast. The only functional difference is replacing three explicit broadcaster assertions with a for loop over self.nodes. This is a code-cleanup change within a fuzzing harness, not a runtime security patch.
Changed components
fuzz/src/chanmon_consistency.rsInspect captured patch +8 / −12
diff --git a/fuzz/src/chanmon_consistency.rs b/fuzz/src/chanmon_consistency.rs
index 9bcd975..6f45250 100644
--- a/fuzz/src/chanmon_consistency.rs
+++ b/fuzz/src/chanmon_consistency.rs
@@ -2232,17 +2232,6 @@ fn build_node_config(chan_type: ChanType) -> UserConfig {
config
}
-fn assert_test_invariants(nodes: &[HarnessNode<'_>; 3]) {
- assert_eq!(nodes[0].list_channels().len(), 3);
- assert_eq!(nodes[1].list_channels().len(), 6);
- assert_eq!(nodes[2].list_channels().len(), 3);
-
- // All broadcasters should be empty. Broadcast transactions are handled explicitly.
- assert!(nodes[0].broadcaster.txn_broadcasted.borrow().is_empty());
- assert!(nodes[1].broadcaster.txn_broadcasted.borrow().is_empty());
- assert!(nodes[2].broadcaster.txn_broadcasted.borrow().is_empty());
-}
-
fn connect_peers(source: &ChanMan<'_>, dest: &ChanMan<'_>) {
let init_dest =
Init { features: dest.init_features(), networks: None, remote_network_address: None };
@@ -2610,7 +2599,14 @@ impl<'a, Out: Output + MaybeSend + MaybeSync> Harness<'a, Out> {
// and mining bytes.
fn finish(&mut self) {
self.mine_relayed_txs_until_quiet();
- assert_test_invariants(&self.nodes);
+ assert_eq!(self.nodes[0].list_channels().len(), 3);
+ assert_eq!(self.nodes[1].list_channels().len(), 6);
+ assert_eq!(self.nodes[2].list_channels().len(), 3);
+
+ // All broadcasters should be empty. Broadcast transactions are handled explicitly.
+ for node in &self.nodes {
+ assert!(node.broadcaster.txn_broadcasted.borrow().is_empty());
+ }
}
fn link_between(&self, source_idx: usize, dest_idx: usize) -> &PeerLink {
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.