Skip to content

Commit 24e89f0

Browse files
authored
Merge pull request #4229 from carlaKC/v3-last-vector
Add duplicate dust test vector for zero fee channels
2 parents 7ca08a9 + 1994661 commit 24e89f0

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

lightning/src/ln/channel.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17552,6 +17552,47 @@ mod tests {
1755217552
Some(htlc_1_in_preimage) }
1755317553
});
1755417554

17555+
// Commitment transaction with similar dust HTLCs below maximum anchor amount
17556+
chan.context.holder_dust_limit_satoshis = 546;
17557+
chan.context.pending_inbound_htlcs.clear();
17558+
chan.context.pending_outbound_htlcs.clear();
17559+
17560+
chan.context.pending_inbound_htlcs.extend([(0, htlc_0_in_hash), (1, htlc_1_in_hash)].map(
17561+
|(htlc_id, payment_hash)| InboundHTLCOutput {
17562+
htlc_id,
17563+
amount_msat: 30000,
17564+
payment_hash,
17565+
cltv_expiry: 920125,
17566+
state: InboundHTLCState::Committed,
17567+
},
17568+
));
17569+
17570+
chan.context.pending_outbound_htlcs.extend(
17571+
[
17572+
(0, "29a74a69c5941d402838f7e1a95c2b2ec534d79524b2582f48df7bc519ebaecf"),
17573+
(1, "1a04764fd402b5557cba89ec3c4d8931b0225d6436923c65c079ce64a55084c4"),
17574+
(2, "29a74a69c5941d402838f7e1a95c2b2ec534d79524b2582f48df7bc519ebaecf"),
17575+
(3, "29a74a69c5941d402838f7e1a95c2b2ec534d79524b2582f48df7bc519ebaecf"),
17576+
]
17577+
.map(|(id, hash)| OutboundHTLCOutput {
17578+
htlc_id: id,
17579+
amount_msat: 30000,
17580+
cltv_expiry: 920125,
17581+
payment_hash: payment_hash_from_hex(hash),
17582+
state: OutboundHTLCState::Committed,
17583+
source: HTLCSource::dummy(),
17584+
skimmed_fee_msat: None,
17585+
blinding_point: None,
17586+
send_timestamp: None,
17587+
hold_htlc: None,
17588+
}),
17589+
);
17590+
17591+
test_commitment_with_zero_fee!(
17592+
"3044022034f22696dd7501d65fc117af3edcfed535eb301317fe35eef08658b571fca4d0022030ff6276cff9e22968f8b08f92a1d4f2c37fe4da29de095df4841d32bdaa501b",
17593+
"30450221009c820c376715329110045b3cf90f59838fd2f86b16774cb5ccccbd6a62830d9602205f2d970bef2589a5e37035937ab7db0461223e429b943b38ecf577e32b7b4572",
17594+
"03000000000101ae1e3c841378cf9e4c383bfdd033d4b3c6945e0587ff16635a00b347eea2704b0100000000340fef8003b4000000000000000451024e7344841e0000000000160014f2123f1a4b67887f2e5f02eda73e6327010152ea88117a0000000000220020f2d298ffcfd6d899a3abada37bfc6f42ce0b7b66f3e39e903e8419ac97dca75a0400473044022034f22696dd7501d65fc117af3edcfed535eb301317fe35eef08658b571fca4d0022030ff6276cff9e22968f8b08f92a1d4f2c37fe4da29de095df4841d32bdaa501b014830450221009c820c376715329110045b3cf90f59838fd2f86b16774cb5ccccbd6a62830d9602205f2d970bef2589a5e37035937ab7db0461223e429b943b38ecf577e32b7b457201475221027eb9596a68740445fb151ff37d5422e7f65f2c497c90fda63e738eb606c15bd62103bbc16dc8851bece603322f06b3c8da329401b7be7e9fdd3f3090ad19aed0807052aec50fbb20", {});
17595+
1755517596
// Commitment transaction with dust HTLCs above maximum anchor amount
1755617597
chan.context.holder_dust_limit_satoshis = 2500;
1755717598
chan.funding.value_to_self_msat = 8000000000;

0 commit comments

Comments
 (0)