Skip to content

Commit 3dbe42a

Browse files
committed
Run async_signer_tests::test_async_holder_signatures with P2A anchors
1 parent a759a06 commit 3dbe42a

File tree

1 file changed

+30
-13
lines changed

1 file changed

+30
-13
lines changed

lightning/src/ln/async_signer_tests.rs

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -972,14 +972,17 @@ fn do_test_async_commitment_signature_ordering(monitor_update_failure: bool) {
972972
claim_payment(&nodes[0], &[&nodes[1]], payment_preimage_2);
973973
}
974974

975-
fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
975+
fn do_test_async_holder_signatures(keyed_anchors: bool, p2a_anchor: bool, remote_commitment: bool) {
976976
// Ensures that we can obtain holder signatures for commitment and HTLC transactions
977977
// asynchronously by allowing their retrieval to fail and retrying via
978978
// `ChannelMonitor::signer_unblocked`.
979979
let mut config = test_default_channel_config();
980-
if anchors {
980+
if keyed_anchors {
981981
config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = true;
982982
config.manually_accept_inbound_channels = true;
983+
} else if p2a_anchor {
984+
config.channel_handshake_config.negotiate_anchor_zero_fee_commitments = true;
985+
config.manually_accept_inbound_channels = true;
983986
}
984987

985988
let chanmon_cfgs = create_chanmon_cfgs(2);
@@ -999,7 +1002,7 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
9991002
script_pubkey: closing_node.wallet_source.get_change_script().unwrap(),
10001003
}],
10011004
};
1002-
if anchors {
1005+
if keyed_anchors || p2a_anchor {
10031006
*nodes[0].fee_estimator.sat_per_kw.lock().unwrap() *= 2;
10041007
*nodes[1].fee_estimator.sat_per_kw.lock().unwrap() *= 2;
10051008
closing_node.wallet_source.add_utxo(
@@ -1051,13 +1054,17 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
10511054
&nodes[0].logger,
10521055
);
10531056
}
1054-
if anchors {
1057+
if keyed_anchors || p2a_anchor {
10551058
handle_bump_close_event(closing_node);
10561059
}
10571060

10581061
let commitment_tx = {
10591062
let mut txn = closing_node.tx_broadcaster.txn_broadcast();
1060-
if anchors || remote_commitment {
1063+
if p2a_anchor {
1064+
assert_eq!(txn.len(), 2);
1065+
check_spends!(txn[0], funding_tx);
1066+
txn.remove(0)
1067+
} else if keyed_anchors || remote_commitment {
10611068
assert_eq!(txn.len(), 1);
10621069
check_spends!(txn[0], funding_tx);
10631070
txn.remove(0)
@@ -1102,7 +1109,7 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
11021109
}
11031110

11041111
// No HTLC transaction should be broadcast as the signer is not available yet.
1105-
if anchors && !remote_commitment {
1112+
if (keyed_anchors || p2a_anchor) && !remote_commitment {
11061113
handle_bump_htlc_event(&nodes[0], 1);
11071114
}
11081115
let txn = nodes[0].tx_broadcaster.txn_broadcast();
@@ -1117,7 +1124,7 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
11171124
&nodes[0].logger,
11181125
);
11191126

1120-
if anchors && !remote_commitment {
1127+
if (keyed_anchors || p2a_anchor) && !remote_commitment {
11211128
handle_bump_htlc_event(&nodes[0], 1);
11221129
}
11231130
{
@@ -1129,22 +1136,32 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
11291136

11301137
#[test]
11311138
fn test_async_holder_signatures_no_anchors() {
1132-
do_test_async_holder_signatures(false, false);
1139+
do_test_async_holder_signatures(false, false, false);
11331140
}
11341141

11351142
#[test]
11361143
fn test_async_holder_signatures_remote_commitment_no_anchors() {
1137-
do_test_async_holder_signatures(false, true);
1144+
do_test_async_holder_signatures(false, false, true);
1145+
}
1146+
1147+
#[test]
1148+
fn test_async_holder_signatures_keyed_anchors() {
1149+
do_test_async_holder_signatures(true, false, false);
1150+
}
1151+
1152+
#[test]
1153+
fn test_async_holder_signatures_remote_commitment_keyed_anchors() {
1154+
do_test_async_holder_signatures(true, false, true);
11381155
}
11391156

11401157
#[test]
1141-
fn test_async_holder_signatures_anchors() {
1142-
do_test_async_holder_signatures(true, false);
1158+
fn test_async_holder_signatures_p2a_anchor() {
1159+
do_test_async_holder_signatures(false, true, false);
11431160
}
11441161

11451162
#[test]
1146-
fn test_async_holder_signatures_remote_commitment_anchors() {
1147-
do_test_async_holder_signatures(true, true);
1163+
fn test_async_holder_signatures_remote_commitment_p2a_anchor() {
1164+
do_test_async_holder_signatures(false, true, true);
11481165
}
11491166

11501167
#[test]

0 commit comments

Comments
 (0)