Skip to content

Run rustfmt on payment_tests and functional_tests and split up the latter #3751

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
25bfbb9
Use variables for node IDs in `payment_tests`
TheBlueMatt May 1, 2025
0bf3801
Clean up payment_tests.rs in anticipation of `rustfmt`'ing it
TheBlueMatt Apr 26, 2025
2bfadd4
f follow pattern more rigorously
TheBlueMatt May 5, 2025
59c43ef
Run `rustfmt` on `payment_tests.rs`
TheBlueMatt May 1, 2025
91036a3
Use `node_id_*` rather than `get_our_node_id()` in functional_tests
TheBlueMatt Apr 27, 2025
6a6894e
f drop unecessary diff
TheBlueMatt May 1, 2025
025d274
Move channel reserve tests out of `functional_tests.rs` into a new file
TheBlueMatt Apr 27, 2025
73cd554
Move more chan reserve tests out of `functional_tests.rs`
TheBlueMatt May 1, 2025
973f4f9
f fix build
TheBlueMatt May 1, 2025
a884856
Move HTLC unit tests out of `functional_tests.rs` into a new file
TheBlueMatt May 1, 2025
9ea3afe
Clean up `htlc_reserve_unit_tests` in anticipation of `rustfmt`
TheBlueMatt May 1, 2025
3407a33
De-macro `check_added_monitors` in `htlc_reserve_unit_tests`
TheBlueMatt Apr 28, 2025
0af1781
Run `rustfmt` on `htlc_reserve_unit_tests.rs`
TheBlueMatt Apr 27, 2025
a95f190
Move channel fee-rated tests out of `functional_tests.rs`
TheBlueMatt Apr 28, 2025
41849e0
Cleanup `update_fee_tests` in anticipation of it being `rustfmt`'d
TheBlueMatt Apr 28, 2025
bdc6457
De-macro `check_added_monitors` in `update_fee_tests.rs`
TheBlueMatt Apr 28, 2025
c90bed2
Run rustfmt on `update_fee_tests`
TheBlueMatt Apr 28, 2025
99b37c1
Remove some useless tests in functional_tests and reject huge chans
TheBlueMatt Apr 28, 2025
9cbc40f
Clean up `functional_tests.rs` in anticipation of `rustfmt`ing it
TheBlueMatt Apr 28, 2025
7430cbe
f drop unecessary \n
TheBlueMatt May 1, 2025
872955e
De-macro `check_added_monitors` in `functional_tests.rs`
TheBlueMatt Apr 28, 2025
200327d
Run `rustfmt` on `functional_tests.rs`
TheBlueMatt Apr 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lightning/src/ln/functional_test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ use crate::chain::transaction::OutPoint;
use crate::events::{ClaimedHTLC, ClosureReason, Event, HTLCHandlingFailureType, PaidBolt12Invoice, PathFailure, PaymentFailureReason, PaymentPurpose};
use crate::events::bump_transaction::{BumpTransactionEvent, BumpTransactionEventHandler, Wallet, WalletSource};
use crate::ln::types::ChannelId;
use crate::types::features::ChannelTypeFeatures;
use crate::types::payment::{PaymentPreimage, PaymentHash, PaymentSecret};
use crate::ln::chan_utils::{commitment_tx_base_weight, COMMITMENT_TX_WEIGHT_PER_HTLC};
use crate::ln::channelmanager::{AChannelManager, ChainParameters, ChannelManager, ChannelManagerReadArgs, RAACommitmentOrder, RecipientOnionFields, PaymentId, MIN_CLTV_EXPIRY_DELTA};
use crate::types::features::InitFeatures;
use crate::ln::msgs;
Expand Down Expand Up @@ -1104,6 +1106,10 @@ macro_rules! unwrap_send_err {
}
}

pub fn commit_tx_fee_msat(feerate: u32, num_htlcs: u64, channel_type_features: &ChannelTypeFeatures) -> u64 {
(commitment_tx_base_weight(channel_type_features) + num_htlcs * COMMITMENT_TX_WEIGHT_PER_HTLC) * feerate as u64 / 1000 * 1000
}

/// Check whether N channel monitor(s) have been added.
pub fn check_added_monitors<CM: AChannelManager, H: NodeHolder<CM=CM>>(node: &H, count: usize) {
if let Some(chain_monitor) = node.chain_monitor() {
Expand Down
11,222 changes: 5,434 additions & 5,788 deletions lightning/src/ln/functional_tests.rs

Large diffs are not rendered by default.

2,080 changes: 2,080 additions & 0 deletions lightning/src/ln/htlc_reserve_unit_tests.rs

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions lightning/src/ln/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ mod async_payments_tests;
#[cfg(any(test, feature = "_externalize_tests"))]
#[allow(unused_mut)]
pub mod functional_tests;
#[cfg(any(test, feature = "_externalize_tests"))]
#[allow(unused_mut)]
pub mod htlc_reserve_unit_tests;
#[cfg(any(test, feature = "_externalize_tests"))]
#[allow(unused_mut)]
pub mod update_fee_tests;
#[cfg(all(test, splicing))]
#[allow(unused_mut)]
mod splicing_tests;
Expand Down
3,113 changes: 1,902 additions & 1,211 deletions lightning/src/ln/payment_tests.rs

Large diffs are not rendered by default.

Loading
Loading