Skip to content

Commit 150f370

Browse files
authored
Merge pull request #979 from tankyleo/2026-07-filter-out-unilateralclose
Do not record unilateral closes as payments
2 parents 1cc60c8 + b34fb66 commit 150f370

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/wallet/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1183,8 +1183,8 @@ impl Wallet {
11831183
LdkTransactionType::InteractiveFunding { candidates } => {
11841184
self.classify_interactive_funding(tx, candidates, tx_type.clone().into()).await
11851185
},
1186+
LdkTransactionType::UnilateralClose { .. } => Ok(()),
11861187
LdkTransactionType::CooperativeClose { .. }
1187-
| LdkTransactionType::UnilateralClose { .. }
11881188
| LdkTransactionType::AnchorBump { .. }
11891189
| LdkTransactionType::Claim { .. }
11901190
| LdkTransactionType::Sweep { .. } => {

tests/common/mod.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ fn assert_any_node_has_onchain_tx_type<F: Fn(&TransactionType) -> bool + Copy>(
438438
}
439439

440440
fn assert_all_nodes_have_onchain_tx_type<F: Fn(&TransactionType) -> bool + Copy>(
441-
nodes: &[(&str, &TestNode)], tx_type_name: &str, predicate: F,
441+
nodes: &[(&str, &TestNode)], panic_msg: &str, tx_type_name: &str, predicate: F,
442442
) {
443443
if nodes.iter().all(|(_, node)| has_onchain_tx_type(node, predicate)) {
444444
return;
@@ -454,8 +454,8 @@ fn assert_all_nodes_have_onchain_tx_type<F: Fn(&TransactionType) -> bool + Copy>
454454
})
455455
.collect();
456456
panic!(
457-
"Expected all nodes to have on-chain payment with tx_type {}; observed {:?}",
458-
tx_type_name, observed
457+
"Expected {}nodes to have on-chain payment with tx_type {}; observed {:?}",
458+
panic_msg, tx_type_name, observed
459459
);
460460
}
461461

@@ -1707,10 +1707,11 @@ pub(crate) async fn do_channel_full_cycle<E: ElectrumApi>(
17071707
node_a.list_peers().iter().any(|p| p.node_id == node_b.node_id() && p.is_persisted),
17081708
"node_b should remain persisted in node_a peer store after locally-initiated force-close"
17091709
);
1710-
assert_any_node_has_onchain_tx_type(
1710+
assert_all_nodes_have_onchain_tx_type(
17111711
&[("node_a", &node_a), ("node_b", &node_b)],
1712+
"no ",
17121713
"UnilateralClose",
1713-
|tx_type| matches!(tx_type, TransactionType::UnilateralClose { .. }),
1714+
|tx_type| !matches!(tx_type, TransactionType::UnilateralClose { .. }),
17141715
);
17151716
assert_any_node_has_onchain_tx_type(
17161717
&[("node_a", &node_a), ("node_b", &node_b)],
@@ -1720,6 +1721,7 @@ pub(crate) async fn do_channel_full_cycle<E: ElectrumApi>(
17201721
} else {
17211722
assert_all_nodes_have_onchain_tx_type(
17221723
&[("node_a", &node_a), ("node_b", &node_b)],
1724+
"all ",
17231725
"CooperativeClose",
17241726
|tx_type| matches!(tx_type, TransactionType::CooperativeClose { .. }),
17251727
);

0 commit comments

Comments
 (0)