@@ -62,8 +62,6 @@ use bitcoin::locktime::absolute::LockTime;
62
62
use bitcoin:: network:: Network ;
63
63
use bitcoin:: opcodes;
64
64
use bitcoin:: script:: Builder ;
65
- use bitcoin:: transaction:: Version ;
66
- use bitcoin:: { Amount , Transaction , TxIn , TxOut } ;
67
65
68
66
use bitcoin:: secp256k1:: Secp256k1 ;
69
67
use bitcoin:: secp256k1:: { PublicKey , SecretKey } ;
@@ -1148,65 +1146,27 @@ pub fn claim_htlc_outputs() {
1148
1146
assert_eq ! ( nodes[ 1 ] . node. list_channels( ) . len( ) , 0 ) ;
1149
1147
}
1150
1148
1151
- // Test that the HTLC package logic removes HTLCs from the package when they are claimed by the
1152
- // counterparty, even when the counterparty claims HTLCs from multiple packages in a single
1153
- // transaction.
1154
- //
1155
- // This is a regression test for https://github.com/lightningdevkit/rust-lightning/issues/3537.
1156
- #[ xtest( feature = "_externalize_tests" ) ]
1157
- pub fn test_multiple_package_conflicts ( ) {
1158
- use crate :: events:: bump_transaction:: sync:: WalletSourceSync ;
1159
-
1149
+ pub fn do_test_multiple_package_conflicts ( p2a_anchor : bool ) {
1160
1150
let chanmon_cfgs = create_chanmon_cfgs ( 3 ) ;
1161
1151
let node_cfgs = create_node_cfgs ( 3 , & chanmon_cfgs) ;
1162
1152
let mut user_cfg = test_default_channel_config ( ) ;
1163
1153
1164
1154
// Anchor channels are required so that multiple HTLC-Successes can be aggregated into a single
1165
1155
// transaction.
1166
1156
user_cfg. channel_handshake_config . negotiate_anchors_zero_fee_htlc_tx = true ;
1157
+ user_cfg. channel_handshake_config . negotiate_anchor_zero_fee_commitments = p2a_anchor;
1167
1158
user_cfg. manually_accept_inbound_channels = true ;
1168
1159
1169
1160
let configs = [ Some ( user_cfg. clone ( ) ) , Some ( user_cfg. clone ( ) ) , Some ( user_cfg) ] ;
1170
1161
let node_chanmgrs = create_node_chanmgrs ( 3 , & node_cfgs, & configs) ;
1171
1162
let nodes = create_network ( 3 , & node_cfgs, & node_chanmgrs) ;
1172
1163
1164
+ let coinbase_tx = provide_anchor_reserves ( & nodes) ;
1165
+
1173
1166
let node_a_id = nodes[ 0 ] . node . get_our_node_id ( ) ;
1174
1167
let node_b_id = nodes[ 1 ] . node . get_our_node_id ( ) ;
1175
1168
let node_c_id = nodes[ 2 ] . node . get_our_node_id ( ) ;
1176
1169
1177
- // Since we're using anchor channels, make sure each node has a UTXO for paying fees.
1178
- let coinbase_tx = Transaction {
1179
- version : Version :: TWO ,
1180
- lock_time : LockTime :: ZERO ,
1181
- input : vec ! [ TxIn { ..Default :: default ( ) } ] ,
1182
- output : vec ! [
1183
- TxOut {
1184
- value: Amount :: ONE_BTC ,
1185
- script_pubkey: nodes[ 0 ] . wallet_source. get_change_script( ) . unwrap( ) ,
1186
- } ,
1187
- TxOut {
1188
- value: Amount :: ONE_BTC ,
1189
- script_pubkey: nodes[ 1 ] . wallet_source. get_change_script( ) . unwrap( ) ,
1190
- } ,
1191
- TxOut {
1192
- value: Amount :: ONE_BTC ,
1193
- script_pubkey: nodes[ 2 ] . wallet_source. get_change_script( ) . unwrap( ) ,
1194
- } ,
1195
- ] ,
1196
- } ;
1197
- nodes[ 0 ] . wallet_source . add_utxo (
1198
- bitcoin:: OutPoint { txid : coinbase_tx. compute_txid ( ) , vout : 0 } ,
1199
- coinbase_tx. output [ 0 ] . value ,
1200
- ) ;
1201
- nodes[ 1 ] . wallet_source . add_utxo (
1202
- bitcoin:: OutPoint { txid : coinbase_tx. compute_txid ( ) , vout : 1 } ,
1203
- coinbase_tx. output [ 1 ] . value ,
1204
- ) ;
1205
- nodes[ 2 ] . wallet_source . add_utxo (
1206
- bitcoin:: OutPoint { txid : coinbase_tx. compute_txid ( ) , vout : 2 } ,
1207
- coinbase_tx. output [ 2 ] . value ,
1208
- ) ;
1209
-
1210
1170
// Create the network.
1211
1171
// 0 -- 1 -- 2
1212
1172
//
@@ -1403,6 +1363,17 @@ pub fn test_multiple_package_conflicts() {
1403
1363
) ;
1404
1364
}
1405
1365
1366
+ // Test that the HTLC package logic removes HTLCs from the package when they are claimed by the
1367
+ // counterparty, even when the counterparty claims HTLCs from multiple packages in a single
1368
+ // transaction.
1369
+ //
1370
+ // This is a regression test for https://github.com/lightningdevkit/rust-lightning/issues/3537.
1371
+ #[ xtest( feature = "_externalize_tests" ) ]
1372
+ pub fn test_multiple_package_conflicts ( ) {
1373
+ do_test_multiple_package_conflicts ( false ) ;
1374
+ do_test_multiple_package_conflicts ( true ) ;
1375
+ }
1376
+
1406
1377
#[ xtest( feature = "_externalize_tests" ) ]
1407
1378
pub fn test_htlc_on_chain_success ( ) {
1408
1379
// Test that in case of a unilateral close onchain, we detect the state of output and pass
0 commit comments