Skip to content

Commit b543afe

Browse files
authored
Merge pull request #3751 from TheBlueMatt/2025-04-rustfmt-tests-1
Run rustfmt on `payment_tests` and `functional_tests` and split up the latter
2 parents edc71d5 + a8b3d36 commit b543afe

7 files changed

+10429
-7003
lines changed

lightning/src/ln/functional_test_utils.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ use crate::chain::transaction::OutPoint;
1616
use crate::events::{ClaimedHTLC, ClosureReason, Event, HTLCHandlingFailureType, PaidBolt12Invoice, PathFailure, PaymentFailureReason, PaymentPurpose};
1717
use crate::events::bump_transaction::{BumpTransactionEvent, BumpTransactionEventHandler, Wallet, WalletSource};
1818
use crate::ln::types::ChannelId;
19+
use crate::types::features::ChannelTypeFeatures;
1920
use crate::types::payment::{PaymentPreimage, PaymentHash, PaymentSecret};
21+
use crate::ln::chan_utils::{commitment_tx_base_weight, COMMITMENT_TX_WEIGHT_PER_HTLC};
2022
use crate::ln::channelmanager::{AChannelManager, ChainParameters, ChannelManager, ChannelManagerReadArgs, RAACommitmentOrder, RecipientOnionFields, PaymentId, MIN_CLTV_EXPIRY_DELTA};
2123
use crate::types::features::InitFeatures;
2224
use crate::ln::msgs;
@@ -1104,6 +1106,10 @@ macro_rules! unwrap_send_err {
11041106
}
11051107
}
11061108

1109+
pub fn commit_tx_fee_msat(feerate: u32, num_htlcs: u64, channel_type_features: &ChannelTypeFeatures) -> u64 {
1110+
(commitment_tx_base_weight(channel_type_features) + num_htlcs * COMMITMENT_TX_WEIGHT_PER_HTLC) * feerate as u64 / 1000 * 1000
1111+
}
1112+
11071113
/// Check whether N channel monitor(s) have been added.
11081114
pub fn check_added_monitors<CM: AChannelManager, H: NodeHolder<CM=CM>>(node: &H, count: usize) {
11091115
if let Some(chain_monitor) = node.chain_monitor() {

lightning/src/ln/functional_tests.rs

Lines changed: 5440 additions & 5786 deletions
Large diffs are not rendered by default.

lightning/src/ln/htlc_reserve_unit_tests.rs

Lines changed: 2080 additions & 0 deletions
Large diffs are not rendered by default.

lightning/src/ln/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ mod async_payments_tests;
6969
#[cfg(any(test, feature = "_externalize_tests"))]
7070
#[allow(unused_mut)]
7171
pub mod functional_tests;
72+
#[cfg(any(test, feature = "_externalize_tests"))]
73+
#[allow(unused_mut)]
74+
pub mod htlc_reserve_unit_tests;
75+
#[cfg(any(test, feature = "_externalize_tests"))]
76+
#[allow(unused_mut)]
77+
pub mod update_fee_tests;
7278
#[cfg(all(test, splicing))]
7379
#[allow(unused_mut)]
7480
mod splicing_tests;

lightning/src/ln/payment_tests.rs

Lines changed: 1909 additions & 1215 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)