You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use crate::sign::{ChannelSigner, EntropySource, InMemorySigner, SignerProvider};
14174
13993
#[cfg(splicing)]
@@ -14432,24 +14251,26 @@ mod tests {
14432
14251
14433
14252
// Make sure when Node A calculates their local commitment transaction, none of the HTLCs pass
14434
14253
// the dust limit check.
14435
-
let htlc_candidate = HTLCCandidate::new(htlc_amount_msat, HTLCInitiator::LocalOffered);
14436
-
let local_commit_tx_fee = node_a_chan.context.next_local_commit_tx_fee_msat(&node_a_chan.funding, htlc_candidate, None);
14254
+
let htlc_candidate = HTLCAmountDirection { amount_msat: htlc_amount_msat, outbound: true };
14255
+
// We set dust_exposure_to_limiting_feerate to Some as the channel type is not zero fee, but we don't care for the value as it has no impact on the commitment transaction fee
let remote_commit_fee_3_htlcs = commit_tx_fee_sat(node_a_chan.context.feerate_per_kw, 3, node_a_chan.funding.get_channel_type()) * 1000;
14444
-
let htlc_candidate = HTLCCandidate::new(htlc_amount_msat, HTLCInitiator::LocalOffered);
14445
-
let remote_commit_tx_fee = node_a_chan.context.next_remote_commit_tx_fee_msat(&node_a_chan.funding, Some(htlc_candidate), None);
14264
+
let htlc_candidate = HTLCAmountDirection { amount_msat: htlc_amount_msat, outbound: true };
14265
+
// We set dust_exposure_to_limiting_feerate to Some as the channel type is not zero fee, but we don't care for the value as it has no impact on the commitment transaction fee
// Make sure that when `next_remote_commit_tx_fee_msat` and `next_local_commit_tx_fee_msat`
14273
+
// Make sure that when `get_next_local/remote_commitment_stats`
14453
14274
// calculate the real dust limits for HTLCs (i.e. the dust limit given by the counterparty
14454
14275
// *plus* the fees paid for the HTLC) they don't swap `HTLC_SUCCESS_TX_WEIGHT` for
14455
14276
// `HTLC_TIMEOUT_TX_WEIGHT`, and vice versa.
@@ -14474,28 +14295,32 @@ mod tests {
14474
14295
// If HTLC_SUCCESS_TX_WEIGHT and HTLC_TIMEOUT_TX_WEIGHT were swapped: then this HTLC would be
14475
14296
// counted as dust when it shouldn't be.
14476
14297
let htlc_amt_above_timeout = (htlc_timeout_tx_fee_sat + chan.context.holder_dust_limit_satoshis + 1) * 1000;
14477
-
let htlc_candidate = HTLCCandidate::new(htlc_amt_above_timeout, HTLCInitiator::LocalOffered);
14478
-
let commitment_tx_fee = chan.context.next_local_commit_tx_fee_msat(&chan.funding, htlc_candidate, None);
14298
+
let htlc_candidate = HTLCAmountDirection { amount_msat: htlc_amt_above_timeout, outbound: true };
14299
+
// We set dust_exposure_to_limiting_feerate to Some as the channel type is not zero fee, but we don't care for the value as it has no impact on the commitment transaction fee
// If swapped: this HTLC would be counted as non-dust when it shouldn't be.
14482
14304
let dust_htlc_amt_below_success = (htlc_success_tx_fee_sat + chan.context.holder_dust_limit_satoshis - 1) * 1000;
14483
-
let htlc_candidate = HTLCCandidate::new(dust_htlc_amt_below_success, HTLCInitiator::RemoteOffered);
14484
-
let commitment_tx_fee = chan.context.next_local_commit_tx_fee_msat(&chan.funding, htlc_candidate, None);
14305
+
let htlc_candidate = HTLCAmountDirection { amount_msat: dust_htlc_amt_below_success, outbound: false };
14306
+
// We set dust_exposure_to_limiting_feerate to Some as the channel type is not zero fee, but we don't care for the value as it has no impact on the commitment transaction fee
// If swapped: this HTLC would be counted as non-dust when it shouldn't be.
14490
14313
let dust_htlc_amt_above_timeout = (htlc_timeout_tx_fee_sat + chan.context.counterparty_dust_limit_satoshis + 1) * 1000;
14491
-
let htlc_candidate = HTLCCandidate::new(dust_htlc_amt_above_timeout, HTLCInitiator::LocalOffered);
14492
-
let commitment_tx_fee = chan.context.next_remote_commit_tx_fee_msat(&chan.funding, Some(htlc_candidate), None);
14314
+
let htlc_candidate = HTLCAmountDirection { amount_msat: dust_htlc_amt_above_timeout, outbound: true };
14315
+
// We set dust_exposure_to_limiting_feerate to Some as the channel type is not zero fee, but we don't care for the value as it has no impact on the commitment transaction fee
// If swapped: this HTLC would be counted as dust when it shouldn't be.
14496
14320
let htlc_amt_below_success = (htlc_success_tx_fee_sat + chan.context.counterparty_dust_limit_satoshis - 1) * 1000;
14497
-
let htlc_candidate = HTLCCandidate::new(htlc_amt_below_success, HTLCInitiator::RemoteOffered);
14498
-
let commitment_tx_fee = chan.context.next_remote_commit_tx_fee_msat(&chan.funding, Some(htlc_candidate), None);
14321
+
let htlc_candidate = HTLCAmountDirection { amount_msat: htlc_amt_below_success, outbound: false };
14322
+
// We set dust_exposure_to_limiting_feerate to Some as the channel type is not zero fee, but we don't care for the value as it has no impact on the commitment transaction fee
0 commit comments