Skip to content

Commit b8f4153

Browse files
committed
WIP: fix test_revoked_counterparty_commitment_balances
1 parent 98ede1c commit b8f4153

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

lightning/src/ln/monitor_tests.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1763,16 +1763,19 @@ fn do_test_revoked_counterparty_htlc_tx_balances(anchors: bool) {
17631763
mine_transaction(&nodes[0], &revoked_htlc_timeout);
17641764
let (revoked_htlc_timeout_claim, revoked_to_self_claim) = {
17651765
let mut as_second_htlc_claim_tx = nodes[0].tx_broadcaster.txn_broadcast();
1766-
assert_eq!(as_second_htlc_claim_tx.len(), if anchors { 1 } else { 2 });
1766+
1767+
let min_claim_tx_count = if anchors { 1 } else { 2 };
1768+
let max_claim_tx_count = min_claim_tx_count + 1;
1769+
assert!(as_second_htlc_claim_tx.len() >= min_claim_tx_count);
1770+
assert!(as_second_htlc_claim_tx.len() <= max_claim_tx_count);
1771+
1772+
assert_eq!(as_second_htlc_claim_tx[0].input.len(), 1);
1773+
assert_eq!(as_second_htlc_claim_tx[0].input[0].previous_output.vout, 0);
1774+
check_spends!(as_second_htlc_claim_tx[0], revoked_htlc_timeout);
1775+
17671776
if anchors {
1768-
assert_eq!(as_second_htlc_claim_tx[0].input.len(), 1);
1769-
assert_eq!(as_second_htlc_claim_tx[0].input[0].previous_output.vout, 0);
1770-
check_spends!(as_second_htlc_claim_tx[0], revoked_htlc_timeout);
17711777
(as_second_htlc_claim_tx.remove(0), revoked_to_self_claim.unwrap())
17721778
} else {
1773-
assert_eq!(as_second_htlc_claim_tx[0].input.len(), 1);
1774-
assert_eq!(as_second_htlc_claim_tx[0].input[0].previous_output.vout, 0);
1775-
check_spends!(as_second_htlc_claim_tx[0], revoked_htlc_timeout);
17761779
assert_eq!(as_second_htlc_claim_tx[1].input.len(), 1);
17771780
assert_eq!(as_second_htlc_claim_tx[1].input[0].previous_output.vout, 2);
17781781
check_spends!(as_second_htlc_claim_tx[1], revoked_local_txn[0]);

0 commit comments

Comments
 (0)