Merge PR 'Fix CI: rebuild test coin-selection impl and rework reused-ID balance test' (#5684)
What changed, and why it matters
This commit is a test-only fix for a broken continuous integration (CI) build. It updates a test mock to match a new function signature and rewrites an existing test to use three nodes instead of two so the test scenario remains valid under recent product changes. There is no change to production code, no vulnerability fix, and no security-relevant behavior change.
No security action required. This is a routine CI/test maintenance commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff touches two test files. In lightning/src/events/bump_transaction/mod.rs, a test-only mock implementation of select_confirmed_utxos adds the new parameter _max_input_prevtx_serialized_len: u64 to match an updated trait signature. In lightning/src/ln/monitor_tests.rs, the unfunded_channel_with_reused_id_does_not_hide_balances test is reworked: it now creates a 3-node network and has the third node (nodes[2]) reuse the closed channel ID, because recent logic rejects reuse of a closed channel ID by the same former counterparty. The test still verifies that ChainMonitor::get_claimable_balances does not skip the closed channel’s monitor when the caller passes list_channels() as ignored_channels. No production logic is modified.
Changed components
lightning/src/events/bump_transaction/mod.rs (test mock only)lightning/src/ln/monitor_tests.rs (test only)Inspect captured patch +26 / −20
### lightning/src/events/bump_transaction/mod.rs
@@ -1065,6 +1065,7 @@ mod tests {
fn select_confirmed_utxos(
&self, claim_id: Option<ClaimId>, must_spend: Vec<Input>, _must_pay_to: &[TxOut],
_target_feerate_sat_per_1000_weight: u32, _max_tx_weight: u64,
+ _max_input_prevtx_serialized_len: u64,
) -> Result<CoinSelection, ()> {
let (batch_size, expected_claim_id) =
self.expected_selects.lock().unwrap().remove(0);
### lightning/src/ln/monitor_tests.rs
@@ -325,10 +325,15 @@ fn unfunded_channel_with_reused_id_does_not_hide_balances() {
// `temporary_channel_id` matches the `channel_id` of a closed channel, doesn't cause
// `ChainMonitor::get_claimable_balances` to skip the closed channel's monitor when the caller
// passes `list_channels()` as `ignored_channels`.
- let chanmon_cfgs = create_chanmon_cfgs(2);
- let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
- let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
+ //
+ // The closed channel's funding transaction confirmed, so it remains tracked by ID for
+ // potential `ChannelMonitorUpdate`s and we reject an `open_channel` reusing that ID from its
+ // former counterparty. The reuse therefore has to come from a third peer, which is exactly
+ // the case the `ChainMonitor` exclusion cannot rely on the `ChannelManager` to prevent.
+ let chanmon_cfgs = create_chanmon_cfgs(3);
+ let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
+ let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let (_, _, chan_id, _) = create_announced_chan_between_nodes(&nodes, 0, 1);
let commitment_tx = get_local_commitment_txn!(nodes[0], chan_id).remove(0);
@@ -352,12 +357,12 @@ fn unfunded_channel_with_reused_id_does_not_hide_balances() {
assert!(!closed_chan_balances.is_empty());
assert_eq!(nodes[0].chain_monitor.chain_monitor.get_claimable_balances(&[]), closed_chan_balances);
- // nodes[1] now requests a new channel, reusing the closed channel's ID as the
+ // nodes[2] now requests a new channel, reusing the closed channel's ID as the
// `temporary_channel_id`, which nodes[0] accepts while it is still unfunded.
- nodes[1].node.create_channel(nodes[0].node.get_our_node_id(), 100_000, 0, 42, Some(chan_id), None).unwrap();
- let open_channel = get_event_msg!(nodes[1], MessageSendEvent::SendOpenChannel, nodes[0].node.get_our_node_id());
- handle_and_accept_open_channel(&nodes[0], nodes[1].node.get_our_node_id(), &open_channel);
- let accept_channel = get_event_msg!(nodes[0], MessageSendEvent::SendAcceptChannel, nodes[1].node.get_our_node_id());
+ nodes[2].node.create_channel(nodes[0].node.get_our_node_id(), 100_000, 0, 42, Some(chan_id), None).unwrap();
+ let open_channel = get_event_msg!(nodes[2], MessageSendEvent::SendOpenChannel, nodes[0].node.get_our_node_id());
+ handle_and_accept_open_channel(&nodes[0], nodes[2].node.get_our_node_id(), &open_channel);
+ let accept_channel = get_event_msg!(nodes[0], MessageSendEvent::SendAcceptChannel, nodes[2].node.get_our_node_id());
let channels = nodes[0].node.list_channels();
assert_eq!(channels.len(), 1);
@@ -371,19 +376,19 @@ fn unfunded_channel_with_reused_id_does_not_hide_balances() {
// Once the new channel is funded it gets a `ChannelMonitor` of its own, under its final ID,
// which is ignored while the closed channel's balances remain visible.
- nodes[1].node.handle_accept_channel(nodes[0].node.get_our_node_id(), &accept_channel);
+ nodes[2].node.handle_accept_channel(nodes[0].node.get_our_node_id(), &accept_channel);
let (temporary_channel_id, tx, funding_outpoint) =
- create_funding_transaction(&nodes[1], &nodes[0].node.get_our_node_id(), 100_000, 42);
- nodes[1].node.funding_transaction_generated(temporary_channel_id, nodes[0].node.get_our_node_id(), tx.clone()).unwrap();
- check_added_monitors(&nodes[1], 0);
- let funding_created = get_event_msg!(nodes[1], MessageSendEvent::SendFundingCreated, nodes[0].node.get_our_node_id());
- nodes[0].node.handle_funding_created(nodes[1].node.get_our_node_id(), &funding_created);
+ create_funding_transaction(&nodes[2], &nodes[0].node.get_our_node_id(), 100_000, 42);
+ nodes[2].node.funding_transaction_generated(temporary_channel_id, nodes[0].node.get_our_node_id(), tx.clone()).unwrap();
+ check_added_monitors(&nodes[2], 0);
+ let funding_created = get_event_msg!(nodes[2], MessageSendEvent::SendFundingCreated, nodes[0].node.get_our_node_id());
+ nodes[0].node.handle_funding_created(nodes[2].node.get_our_node_id(), &funding_created);
check_added_monitors(&nodes[0], 1);
- expect_channel_pending_event(&nodes[0], &nodes[1].node.get_our_node_id());
- let funding_signed = get_event_msg!(nodes[0], MessageSendEvent::SendFundingSigned, nodes[1].node.get_our_node_id());
- nodes[1].node.handle_funding_signed(nodes[0].node.get_our_node_id(), &funding_signed);
- check_added_monitors(&nodes[1], 1);
- expect_channel_pending_event(&nodes[1], &nodes[0].node.get_our_node_id());
+ expect_channel_pending_event(&nodes[0], &nodes[2].node.get_our_node_id());
+ let funding_signed = get_event_msg!(nodes[0], MessageSendEvent::SendFundingSigned, nodes[2].node.get_our_node_id());
+ nodes[2].node.handle_funding_signed(nodes[0].node.get_our_node_id(), &funding_signed);
+ check_added_monitors(&nodes[2], 1);
+ expect_channel_pending_event(&nodes[2], &nodes[0].node.get_our_node_id());
let channels = nodes[0].node.list_channels();
assert_eq!(channels.len(), 1);Why this scored 12/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.