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