@@ -972,14 +972,17 @@ fn do_test_async_commitment_signature_ordering(monitor_update_failure: bool) {
972
972
claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2) ;
973
973
}
974
974
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 ) {
976
976
// Ensures that we can obtain holder signatures for commitment and HTLC transactions
977
977
// asynchronously by allowing their retrieval to fail and retrying via
978
978
// `ChannelMonitor::signer_unblocked`.
979
979
let mut config = test_default_channel_config ( ) ;
980
- if anchors {
980
+ if keyed_anchors {
981
981
config. channel_handshake_config . negotiate_anchors_zero_fee_htlc_tx = true ;
982
982
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 ;
983
986
}
984
987
985
988
let chanmon_cfgs = create_chanmon_cfgs ( 2 ) ;
@@ -999,7 +1002,7 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
999
1002
script_pubkey: closing_node. wallet_source. get_change_script( ) . unwrap( ) ,
1000
1003
} ] ,
1001
1004
} ;
1002
- if anchors {
1005
+ if keyed_anchors || p2a_anchor {
1003
1006
* nodes[ 0 ] . fee_estimator . sat_per_kw . lock ( ) . unwrap ( ) *= 2 ;
1004
1007
* nodes[ 1 ] . fee_estimator . sat_per_kw . lock ( ) . unwrap ( ) *= 2 ;
1005
1008
closing_node. wallet_source . add_utxo (
@@ -1051,13 +1054,17 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
1051
1054
& nodes[ 0 ] . logger ,
1052
1055
) ;
1053
1056
}
1054
- if anchors {
1057
+ if keyed_anchors || p2a_anchor {
1055
1058
handle_bump_close_event ( closing_node) ;
1056
1059
}
1057
1060
1058
1061
let commitment_tx = {
1059
1062
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 {
1061
1068
assert_eq ! ( txn. len( ) , 1 ) ;
1062
1069
check_spends ! ( txn[ 0 ] , funding_tx) ;
1063
1070
txn. remove ( 0 )
@@ -1102,7 +1109,7 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
1102
1109
}
1103
1110
1104
1111
// 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 {
1106
1113
handle_bump_htlc_event ( & nodes[ 0 ] , 1 ) ;
1107
1114
}
1108
1115
let txn = nodes[ 0 ] . tx_broadcaster . txn_broadcast ( ) ;
@@ -1117,7 +1124,7 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
1117
1124
& nodes[ 0 ] . logger ,
1118
1125
) ;
1119
1126
1120
- if anchors && !remote_commitment {
1127
+ if ( keyed_anchors || p2a_anchor ) && !remote_commitment {
1121
1128
handle_bump_htlc_event ( & nodes[ 0 ] , 1 ) ;
1122
1129
}
1123
1130
{
@@ -1129,22 +1136,32 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
1129
1136
1130
1137
#[ test]
1131
1138
fn test_async_holder_signatures_no_anchors ( ) {
1132
- do_test_async_holder_signatures ( false , false ) ;
1139
+ do_test_async_holder_signatures ( false , false , false ) ;
1133
1140
}
1134
1141
1135
1142
#[ test]
1136
1143
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 ) ;
1138
1155
}
1139
1156
1140
1157
#[ 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 ) ;
1143
1160
}
1144
1161
1145
1162
#[ 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 ) ;
1148
1165
}
1149
1166
1150
1167
#[ test]
0 commit comments