Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
9 changes: 8 additions & 1 deletion lightning/src/ln/chanmon_update_fail_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2839,10 +2839,17 @@ fn do_channel_holding_cell_serialize(disconnect: bool, reload_a: bool) {
claim_payment(&nodes[0], &[&nodes[1]], payment_preimage_1);
claim_payment(&nodes[0], &[&nodes[1]], payment_preimage_2);
}

#[test]
fn channel_holding_cell_serialize() {
fn channel_holding_cell_serialize_with_disconnect_and_reload() {
do_channel_holding_cell_serialize(true, true);
}
#[test]
fn channel_holding_cell_serialize_with_disconnect() {
do_channel_holding_cell_serialize(true, false);
}
#[test]
fn channel_holding_cell_serialize() {
do_channel_holding_cell_serialize(false, true); // last arg doesn't matter
}

Expand Down
54 changes: 52 additions & 2 deletions lightning/src/ln/payment_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1403,15 +1403,39 @@ fn do_test_dup_htlc_onchain_doesnt_fail_on_reload(
}

#[test]
fn test_dup_htlc_onchain_doesnt_fail_on_reload() {
fn test_dup_htlc_onchain_doesnt_fail_on_reload_0() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunate that rust doesn't have sub-tests. The numbering isn't ideal, but trying to come up with something descriptive probably isn't going to work either...

do_test_dup_htlc_onchain_doesnt_fail_on_reload(true, true, true, true);
}
#[test]
fn test_dup_htlc_onchain_doesnt_fail_on_reload_1() {
do_test_dup_htlc_onchain_doesnt_fail_on_reload(true, true, true, false);
}
#[test]
fn test_dup_htlc_onchain_doesnt_fail_on_reload_2() {
do_test_dup_htlc_onchain_doesnt_fail_on_reload(true, true, false, false);
}
#[test]
fn test_dup_htlc_onchain_doesnt_fail_on_reload_3() {
do_test_dup_htlc_onchain_doesnt_fail_on_reload(true, false, true, true);
}
#[test]
fn test_dup_htlc_onchain_doesnt_fail_on_reload_4() {
do_test_dup_htlc_onchain_doesnt_fail_on_reload(true, false, true, false);
}
#[test]
fn test_dup_htlc_onchain_doesnt_fail_on_reload_5() {
do_test_dup_htlc_onchain_doesnt_fail_on_reload(true, false, false, false);
}
#[test]
fn test_dup_htlc_onchain_doesnt_fail_on_reload_6() {
do_test_dup_htlc_onchain_doesnt_fail_on_reload(false, false, true, true);
}
#[test]
fn test_dup_htlc_onchain_doesnt_fail_on_reload_7() {
do_test_dup_htlc_onchain_doesnt_fail_on_reload(false, false, true, false);
}
#[test]
fn test_dup_htlc_onchain_doesnt_fail_on_reload_8() {
do_test_dup_htlc_onchain_doesnt_fail_on_reload(false, false, false, false);
}

Expand Down Expand Up @@ -2588,14 +2612,40 @@ enum AutoRetry {
}

#[test]
fn automatic_retries() {
fn automatic_retry_success() {
do_automatic_retries(AutoRetry::Success);
}

#[test]
fn automatic_retry_spontaneous_payment() {
do_automatic_retries(AutoRetry::Spontaneous);
}

#[test]
fn automatic_retry_attempts_fail() {
// The payment is automatically retried but fails due to running out of payment attempts.
do_automatic_retries(AutoRetry::FailAttempts);
}

#[test]
fn automatic_retry_timeout_fail() {
// The payment is automatically retried but fails due to running out of time.
do_automatic_retries(AutoRetry::FailTimeout);
}

#[test]
fn automatic_retry_restart_fail() {
// The payment is automatically retried but fails due to a node restart.
do_automatic_retries(AutoRetry::FailOnRestart);
}

#[test]
fn automatic_retry_fail_on_retry() {
// The payment is automatically retried but the retry fails (in this case due to no channel being
// available).
do_automatic_retries(AutoRetry::FailOnRetry);
}

fn do_automatic_retries(test: AutoRetry) {
// Test basic automatic payment retries in ChannelManager. See individual `test` variant comments
// below.
Expand Down