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 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1db5515
Use variables for node IDs in `payment_tests`
TheBlueMatt May 1, 2025
66a0b59
Clean up payment_tests.rs in anticipation of `rustfmt`'ing it
TheBlueMatt Apr 26, 2025
6ec9a47
f follow pattern more rigorously
TheBlueMatt May 5, 2025
f180cae
f restore the payment_ in payment_secret (incl places it wasn't)
TheBlueMatt May 12, 2025
8757b65
f more _monitor in chain_monitor
TheBlueMatt May 12, 2025
5a0ced5
Run `rustfmt` on `payment_tests.rs`
TheBlueMatt May 1, 2025
c3fabc3
Use `node_id_*` rather than `get_our_node_id()` in functional_tests
TheBlueMatt Apr 27, 2025
5ad41e5
f drop unecessary diff
TheBlueMatt May 1, 2025
93d2a08
Move channel reserve tests out of `functional_tests.rs` into a new file
TheBlueMatt Apr 27, 2025
4dddaf8
Move more chan reserve tests out of `functional_tests.rs`
TheBlueMatt May 1, 2025
1764cf9
f fix build
TheBlueMatt May 1, 2025
021dc4c
Move HTLC unit tests out of `functional_tests.rs` into a new file
TheBlueMatt May 1, 2025
8f3baa9
Clean up `htlc_reserve_unit_tests` in anticipation of `rustfmt`
TheBlueMatt May 1, 2025
9c185f6
De-macro `check_added_monitors` in `htlc_reserve_unit_tests`
TheBlueMatt Apr 28, 2025
b6c59eb
Run `rustfmt` on `htlc_reserve_unit_tests.rs`
TheBlueMatt Apr 27, 2025
db36f08
Move channel fee-rated tests out of `functional_tests.rs`
TheBlueMatt Apr 28, 2025
727d782
Cleanup `update_fee_tests` in anticipation of it being `rustfmt`'d
TheBlueMatt Apr 28, 2025
d5b6a7a
De-macro `check_added_monitors` in `update_fee_tests.rs`
TheBlueMatt Apr 28, 2025
415b6a1
Run rustfmt on `update_fee_tests`
TheBlueMatt Apr 28, 2025
7587580
Remove some useless tests in functional_tests and reject huge chans
TheBlueMatt Apr 28, 2025
4a5be89
Clean up `functional_tests.rs` in anticipation of `rustfmt`ing it
TheBlueMatt Apr 28, 2025
8465d8a
f drop unecessary \n
TheBlueMatt May 1, 2025
791fcb5
f re-add the payment_ in payment_secret, even where it wasn't
TheBlueMatt May 12, 2025
398b280
De-macro `check_added_monitors` in `functional_tests.rs`
TheBlueMatt Apr 28, 2025
726ec92
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,226 changes: 5,440 additions & 5,786 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,124 changes: 1,909 additions & 1,215 deletions lightning/src/ln/payment_tests.rs

Large diffs are not rendered by default.

Loading
Loading