@@ -92,9 +92,13 @@ fn chanmon_fail_from_stale_commitment() {
92
92
expect_payment_failed_with_update ! ( nodes[ 0 ] , payment_hash, false , update_a. contents. short_channel_id, true ) ;
93
93
}
94
94
95
- fn test_spendable_output < ' a , ' b , ' c , ' d > ( node : & ' a Node < ' b , ' c , ' d > , spendable_tx : & Transaction ) {
95
+ fn test_spendable_output < ' a , ' b , ' c , ' d > ( node : & ' a Node < ' b , ' c , ' d > , spendable_tx : & Transaction , has_anchors_htlc_event : bool ) {
96
96
let mut spendable = node. chain_monitor . chain_monitor . get_and_clear_pending_events ( ) ;
97
- assert_eq ! ( spendable. len( ) , 1 ) ;
97
+ assert_eq ! ( spendable. len( ) , if has_anchors_htlc_event { 2 } else { 1 } ) ;
98
+ if has_anchors_htlc_event {
99
+ if let Event :: BumpTransaction ( BumpTransactionEvent :: HTLCResolution { .. } ) = spendable. pop ( ) . unwrap ( ) { }
100
+ else { panic ! ( ) ; }
101
+ }
98
102
if let Event :: SpendableOutputs { outputs, .. } = spendable. pop ( ) . unwrap ( ) {
99
103
assert_eq ! ( outputs. len( ) , 1 ) ;
100
104
let spend_tx = node. keys_manager . backing . spend_spendable_outputs ( & [ & outputs[ 0 ] ] , Vec :: new ( ) ,
@@ -230,8 +234,8 @@ fn do_chanmon_claim_value_coop_close(anchors: bool) {
230
234
assert_eq ! ( Vec :: <Balance >:: new( ) ,
231
235
nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ;
232
236
233
- test_spendable_output ( & nodes[ 0 ] , & shutdown_tx[ 0 ] ) ;
234
- test_spendable_output ( & nodes[ 1 ] , & shutdown_tx[ 0 ] ) ;
237
+ test_spendable_output ( & nodes[ 0 ] , & shutdown_tx[ 0 ] , false ) ;
238
+ test_spendable_output ( & nodes[ 1 ] , & shutdown_tx[ 0 ] , false ) ;
235
239
236
240
check_closed_event ! ( nodes[ 0 ] , 1 , ClosureReason :: CooperativeClosure , [ nodes[ 1 ] . node. get_our_node_id( ) ] , 1000000 ) ;
237
241
check_closed_event ! ( nodes[ 1 ] , 1 , ClosureReason :: CooperativeClosure , [ nodes[ 0 ] . node. get_our_node_id( ) ] , 1000000 ) ;
@@ -259,7 +263,7 @@ fn fuzzy_assert_eq<V: core::convert::TryInto<u64>>(a: V, b: V) {
259
263
assert ! ( b_u64 >= a_u64 - 5 ) ;
260
264
}
261
265
262
- fn do_test_claim_value_force_close ( prev_commitment_tx : bool ) {
266
+ fn do_test_claim_value_force_close ( anchors : bool , prev_commitment_tx : bool ) {
263
267
// Tests `get_claimable_balances` with an HTLC across a force-close.
264
268
// We build a channel with an HTLC pending, then force close the channel and check that the
265
269
// `get_claimable_balances` return value is correct as transactions confirm on-chain.
@@ -272,9 +276,34 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
272
276
chanmon_cfgs[ 1 ] . keys_manager . disable_revocation_policy_check = true ;
273
277
}
274
278
let node_cfgs = create_node_cfgs ( 2 , & chanmon_cfgs) ;
275
- let node_chanmgrs = create_node_chanmgrs ( 2 , & node_cfgs, & [ None , None ] ) ;
279
+ let mut user_config = test_default_channel_config ( ) ;
280
+ if anchors {
281
+ user_config. channel_handshake_config . negotiate_anchors_zero_fee_htlc_tx = true ;
282
+ user_config. manually_accept_inbound_channels = true ;
283
+ }
284
+ let node_chanmgrs = create_node_chanmgrs ( 2 , & node_cfgs, & [ Some ( user_config) , Some ( user_config) ] ) ;
276
285
let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
277
286
287
+ let coinbase_tx = Transaction {
288
+ version : 2 ,
289
+ lock_time : PackedLockTime :: ZERO ,
290
+ input : vec ! [ TxIn { ..Default :: default ( ) } ] ,
291
+ output : vec ! [
292
+ TxOut {
293
+ value: Amount :: ONE_BTC . to_sat( ) ,
294
+ script_pubkey: nodes[ 0 ] . wallet_source. get_change_script( ) . unwrap( ) ,
295
+ } ,
296
+ TxOut {
297
+ value: Amount :: ONE_BTC . to_sat( ) ,
298
+ script_pubkey: nodes[ 1 ] . wallet_source. get_change_script( ) . unwrap( ) ,
299
+ } ,
300
+ ] ,
301
+ } ;
302
+ if anchors {
303
+ nodes[ 0 ] . wallet_source . add_utxo ( bitcoin:: OutPoint { txid : coinbase_tx. txid ( ) , vout : 0 } , coinbase_tx. output [ 0 ] . value ) ;
304
+ nodes[ 1 ] . wallet_source . add_utxo ( bitcoin:: OutPoint { txid : coinbase_tx. txid ( ) , vout : 1 } , coinbase_tx. output [ 1 ] . value ) ;
305
+ }
306
+
278
307
let ( _, _, chan_id, funding_tx) =
279
308
create_announced_chan_between_nodes_with_value ( & nodes, 0 , 1 , 1_000_000 , 1_000_000 ) ;
280
309
let funding_outpoint = OutPoint { txid : funding_tx. txid ( ) , index : 0 } ;
@@ -290,7 +319,7 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
290
319
291
320
let htlc_cltv_timeout = nodes[ 0 ] . best_block_info ( ) . 1 + TEST_FINAL_CLTV + 1 ; // Note ChannelManager adds one to CLTV timeouts for safety
292
321
293
- let chan_feerate = get_feerate ! ( nodes[ 0 ] , nodes[ 1 ] , chan_id) as u64 ;
322
+ let chan_feerate = get_feerate ! ( nodes[ 0 ] , nodes[ 1 ] , chan_id) ;
294
323
let channel_type_features = get_channel_type_features ! ( nodes[ 0 ] , nodes[ 1 ] , chan_id) ;
295
324
296
325
let remote_txn = get_local_commitment_txn ! ( nodes[ 1 ] , chan_id) ;
@@ -329,9 +358,11 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
329
358
330
359
// Before B receives the payment preimage, it only suggests the push_msat value of 1_000 sats
331
360
// as claimable. A lists both its to-self balance and the (possibly-claimable) HTLCs.
361
+ let commitment_tx_fee = chan_feerate as u64 *
362
+ ( channel:: commitment_tx_base_weight ( & channel_type_features) + 2 * channel:: COMMITMENT_TX_WEIGHT_PER_HTLC ) / 1000 ;
363
+ let anchor_outputs_value = if anchors { 2 * channel:: ANCHOR_OUTPUT_VALUE_SATOSHI } else { 0 } ;
332
364
assert_eq ! ( sorted_vec( vec![ Balance :: ClaimableOnChannelClose {
333
- amount_satoshis: 1_000_000 - 3_000 - 4_000 - 1_000 - 3 - chan_feerate *
334
- ( channel:: commitment_tx_base_weight( & channel_type_features) + 2 * channel:: COMMITMENT_TX_WEIGHT_PER_HTLC ) / 1000 ,
365
+ amount_satoshis: 1_000_000 - 3_000 - 4_000 - 1_000 - 3 - commitment_tx_fee - anchor_outputs_value,
335
366
} , sent_htlc_balance. clone( ) , sent_htlc_timeout_balance. clone( ) ] ) ,
336
367
sorted_vec( nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ) ;
337
368
assert_eq ! ( sorted_vec( vec![ Balance :: ClaimableOnChannelClose {
@@ -371,16 +402,17 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
371
402
372
403
// Once B has received the payment preimage, it includes the value of the HTLC in its
373
404
// "claimable if you were to close the channel" balance.
405
+ let commitment_tx_fee = chan_feerate as u64 *
406
+ ( channel:: commitment_tx_base_weight ( & channel_type_features) +
407
+ if prev_commitment_tx { 1 } else { 2 } * channel:: COMMITMENT_TX_WEIGHT_PER_HTLC ) / 1000 ;
374
408
let mut a_expected_balances = vec ! [ Balance :: ClaimableOnChannelClose {
375
409
amount_satoshis: 1_000_000 - // Channel funding value in satoshis
376
410
4_000 - // The to-be-failed HTLC value in satoshis
377
411
3_000 - // The claimed HTLC value in satoshis
378
412
1_000 - // The push_msat value in satoshis
379
413
3 - // The dust HTLC value in satoshis
380
- // The commitment transaction fee with two HTLC outputs:
381
- chan_feerate * ( channel:: commitment_tx_base_weight( & channel_type_features) +
382
- if prev_commitment_tx { 1 } else { 2 } *
383
- channel:: COMMITMENT_TX_WEIGHT_PER_HTLC ) / 1000 ,
414
+ commitment_tx_fee - // The commitment transaction fee with two HTLC outputs
415
+ anchor_outputs_value, // The anchor outputs value in satoshis
384
416
} , sent_htlc_timeout_balance. clone( ) ] ;
385
417
if !prev_commitment_tx {
386
418
a_expected_balances. push ( sent_htlc_balance. clone ( ) ) ;
@@ -398,13 +430,37 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
398
430
mine_transaction ( & nodes[ 0 ] , & remote_txn[ 0 ] ) ;
399
431
mine_transaction ( & nodes[ 1 ] , & remote_txn[ 0 ] ) ;
400
432
401
- let b_broadcast_txn = nodes[ 1 ] . tx_broadcaster . txn_broadcasted . lock ( ) . unwrap ( ) . split_off ( 0 ) ;
433
+ if anchors {
434
+ let mut events = nodes[ 1 ] . chain_monitor . chain_monitor . get_and_clear_pending_events ( ) ;
435
+ assert_eq ! ( events. len( ) , 1 ) ;
436
+ match events. pop ( ) . unwrap ( ) {
437
+ Event :: BumpTransaction ( bump_event) => {
438
+ let mut first_htlc_event = bump_event. clone ( ) ;
439
+ if let BumpTransactionEvent :: HTLCResolution { ref mut htlc_descriptors, .. } = & mut first_htlc_event {
440
+ htlc_descriptors. remove ( 1 ) ;
441
+ } else {
442
+ panic ! ( "Unexpected event" ) ;
443
+ }
444
+ let mut second_htlc_event = bump_event;
445
+ if let BumpTransactionEvent :: HTLCResolution { ref mut htlc_descriptors, .. } = & mut second_htlc_event {
446
+ htlc_descriptors. remove ( 0 ) ;
447
+ } else {
448
+ panic ! ( "Unexpected event" ) ;
449
+ }
450
+ nodes[ 1 ] . bump_tx_handler . handle_event ( & first_htlc_event) ;
451
+ nodes[ 1 ] . bump_tx_handler . handle_event ( & second_htlc_event) ;
452
+ } ,
453
+ _ => panic ! ( "Unexpected event" ) ,
454
+ }
455
+ }
456
+
457
+ let b_broadcast_txn = nodes[ 1 ] . tx_broadcaster . txn_broadcast ( ) ;
402
458
assert_eq ! ( b_broadcast_txn. len( ) , 2 ) ;
403
459
// b_broadcast_txn should spend the HTLCs output of the commitment tx for 3_000 and 4_000 sats
404
- check_spends ! ( b_broadcast_txn[ 0 ] , remote_txn[ 0 ] ) ;
405
- check_spends ! ( b_broadcast_txn[ 1 ] , remote_txn[ 0 ] ) ;
406
- assert_eq ! ( b_broadcast_txn[ 0 ] . input. len( ) , 1 ) ;
407
- assert_eq ! ( b_broadcast_txn[ 1 ] . input. len( ) , 1 ) ;
460
+ check_spends ! ( b_broadcast_txn[ 0 ] , remote_txn[ 0 ] , coinbase_tx ) ;
461
+ check_spends ! ( b_broadcast_txn[ 1 ] , remote_txn[ 0 ] , coinbase_tx ) ;
462
+ assert_eq ! ( b_broadcast_txn[ 0 ] . input. len( ) , if anchors { 2 } else { 1 } ) ;
463
+ assert_eq ! ( b_broadcast_txn[ 1 ] . input. len( ) , if anchors { 2 } else { 1 } ) ;
408
464
assert_eq ! ( remote_txn[ 0 ] . output[ b_broadcast_txn[ 0 ] . input[ 0 ] . previous_output. vout as usize ] . value, 3_000 ) ;
409
465
assert_eq ! ( remote_txn[ 0 ] . output[ b_broadcast_txn[ 1 ] . input[ 0 ] . previous_output. vout as usize ] . value, 4_000 ) ;
410
466
@@ -425,10 +481,10 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
425
481
// other Balance variants, as close has already happened.
426
482
assert ! ( nodes[ 0 ] . chain_monitor. chain_monitor. get_and_clear_pending_events( ) . is_empty( ) ) ;
427
483
assert ! ( nodes[ 1 ] . chain_monitor. chain_monitor. get_and_clear_pending_events( ) . is_empty( ) ) ;
428
-
484
+ let commitment_tx_fee = chan_feerate as u64 *
485
+ ( channel:: commitment_tx_base_weight ( & channel_type_features) + 2 * channel:: COMMITMENT_TX_WEIGHT_PER_HTLC ) / 1000 ;
429
486
assert_eq ! ( sorted_vec( vec![ Balance :: ClaimableAwaitingConfirmations {
430
- amount_satoshis: 1_000_000 - 3_000 - 4_000 - 1_000 - 3 - chan_feerate *
431
- ( channel:: commitment_tx_base_weight( & channel_type_features) + 2 * channel:: COMMITMENT_TX_WEIGHT_PER_HTLC ) / 1000 ,
487
+ amount_satoshis: 1_000_000 - 3_000 - 4_000 - 1_000 - 3 - commitment_tx_fee - anchor_outputs_value,
432
488
confirmation_height: nodes[ 0 ] . best_block_info( ) . 1 + ANTI_REORG_DELAY - 1 ,
433
489
} , sent_htlc_balance. clone( ) , sent_htlc_timeout_balance. clone( ) ] ) ,
434
490
sorted_vec( nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ) ;
@@ -457,7 +513,7 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
457
513
} , received_htlc_claiming_balance. clone( ) , received_htlc_timeout_claiming_balance. clone( ) ] ) ,
458
514
sorted_vec( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ) ;
459
515
460
- test_spendable_output ( & nodes[ 0 ] , & remote_txn[ 0 ] ) ;
516
+ test_spendable_output ( & nodes[ 0 ] , & remote_txn[ 0 ] , false ) ;
461
517
assert ! ( nodes[ 1 ] . chain_monitor. chain_monitor. get_and_clear_pending_events( ) . is_empty( ) ) ;
462
518
463
519
// After broadcasting the HTLC claim transaction, node A will still consider the HTLC
@@ -504,7 +560,7 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
504
560
nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ;
505
561
expect_payment_failed ! ( nodes[ 0 ] , timeout_payment_hash, false ) ;
506
562
507
- test_spendable_output ( & nodes[ 0 ] , & a_broadcast_txn[ 1 ] ) ;
563
+ test_spendable_output ( & nodes[ 0 ] , & a_broadcast_txn[ 1 ] , false ) ;
508
564
509
565
// Node B will no longer consider the HTLC "contentious" after the HTLC claim transaction
510
566
// confirms, and consider it simply "awaiting confirmations". Note that it has to wait for the
@@ -524,7 +580,7 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
524
580
// After reaching the commitment output CSV, we'll get a SpendableOutputs event for it and have
525
581
// only the HTLCs claimable on node B.
526
582
connect_blocks ( & nodes[ 1 ] , node_b_commitment_claimable - nodes[ 1 ] . best_block_info ( ) . 1 ) ;
527
- test_spendable_output ( & nodes[ 1 ] , & remote_txn[ 0 ] ) ;
583
+ test_spendable_output ( & nodes[ 1 ] , & remote_txn[ 0 ] , anchors ) ;
528
584
529
585
assert_eq ! ( sorted_vec( vec![ Balance :: ClaimableAwaitingConfirmations {
530
586
amount_satoshis: 3_000 ,
@@ -535,7 +591,7 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
535
591
// After reaching the claimed HTLC output CSV, we'll get a SpendableOutptus event for it and
536
592
// have only one HTLC output left spendable.
537
593
connect_blocks ( & nodes[ 1 ] , node_b_htlc_claimable - nodes[ 1 ] . best_block_info ( ) . 1 ) ;
538
- test_spendable_output ( & nodes[ 1 ] , & b_broadcast_txn[ 0 ] ) ;
594
+ test_spendable_output ( & nodes[ 1 ] , & b_broadcast_txn[ 0 ] , anchors ) ;
539
595
540
596
assert_eq ! ( vec![ received_htlc_timeout_claiming_balance. clone( ) ] ,
541
597
nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ;
@@ -563,8 +619,10 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
563
619
564
620
#[ test]
565
621
fn test_claim_value_force_close ( ) {
566
- do_test_claim_value_force_close ( true ) ;
567
- do_test_claim_value_force_close ( false ) ;
622
+ do_test_claim_value_force_close ( false , true ) ;
623
+ do_test_claim_value_force_close ( false , false ) ;
624
+ do_test_claim_value_force_close ( true , true ) ;
625
+ do_test_claim_value_force_close ( true , false ) ;
568
626
}
569
627
570
628
#[ test]
@@ -728,13 +786,13 @@ fn test_balances_on_local_commitment_htlcs() {
728
786
confirmation_height: node_a_htlc_claimable,
729
787
} ] ,
730
788
nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ;
731
- test_spendable_output ( & nodes[ 0 ] , & as_txn [ 0 ] ) ;
789
+ test_spendable_output ( & nodes[ 0 ] , & commitment_tx , false ) ;
732
790
733
791
// Connect blocks until the HTLC-Timeout's CSV expires, providing us the relevant
734
792
// `SpendableOutputs` event and removing the claimable balance entry.
735
793
connect_blocks ( & nodes[ 0 ] , node_a_htlc_claimable - nodes[ 0 ] . best_block_info ( ) . 1 ) ;
736
794
assert ! ( nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) . is_empty( ) ) ;
737
- test_spendable_output ( & nodes[ 0 ] , & as_txn [ 1 ] ) ;
795
+ test_spendable_output ( & nodes[ 0 ] , & timeout_htlc_txn [ 0 ] , false ) ;
738
796
739
797
// Ensure that even if we connect more blocks, potentially replaying the entire chain if we're
740
798
// using `ConnectStyle::HighlyRedundantTransactionsFirstSkippingBlocks`, we don't get new
@@ -859,7 +917,7 @@ fn test_no_preimage_inbound_htlc_balances() {
859
917
860
918
// For node B, we'll get the non-HTLC funds claimable after ANTI_REORG_DELAY confirmations
861
919
connect_blocks ( & nodes[ 1 ] , ANTI_REORG_DELAY - 1 ) ;
862
- test_spendable_output ( & nodes[ 1 ] , & as_txn[ 0 ] ) ;
920
+ test_spendable_output ( & nodes[ 1 ] , & as_txn[ 0 ] , false ) ;
863
921
bs_pre_spend_claims. retain ( |e| if let Balance :: ClaimableAwaitingConfirmations { .. } = e { false } else { true } ) ;
864
922
865
923
// The next few blocks for B look the same as for A, though for the opposite HTLC
@@ -925,11 +983,11 @@ fn test_no_preimage_inbound_htlc_balances() {
925
983
confirmation_height: core:: cmp:: max( as_timeout_claimable_height, htlc_cltv_timeout) ,
926
984
} ] ,
927
985
nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ;
928
- test_spendable_output ( & nodes[ 0 ] , & as_txn[ 0 ] ) ;
986
+ test_spendable_output ( & nodes[ 0 ] , & as_txn[ 0 ] , false ) ;
929
987
930
988
connect_blocks ( & nodes[ 0 ] , as_timeout_claimable_height - nodes[ 0 ] . best_block_info ( ) . 1 ) ;
931
989
assert ! ( nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) . is_empty( ) ) ;
932
- test_spendable_output ( & nodes[ 0 ] , & as_htlc_timeout_claim[ 0 ] ) ;
990
+ test_spendable_output ( & nodes[ 0 ] , & as_htlc_timeout_claim[ 0 ] , false ) ;
933
991
934
992
// The process for B should be completely identical as well, noting that the non-HTLC-balance
935
993
// was already claimed.
@@ -953,7 +1011,7 @@ fn test_no_preimage_inbound_htlc_balances() {
953
1011
954
1012
assert_eq ! ( vec![ b_received_htlc_balance. clone( ) ] ,
955
1013
nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ;
956
- test_spendable_output ( & nodes[ 1 ] , & bs_htlc_timeout_claim[ 0 ] ) ;
1014
+ test_spendable_output ( & nodes[ 1 ] , & bs_htlc_timeout_claim[ 0 ] , false ) ;
957
1015
958
1016
connect_blocks ( & nodes[ 1 ] , 1 ) ;
959
1017
assert ! ( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) . is_empty( ) ) ;
@@ -1197,7 +1255,7 @@ fn do_test_revoked_counterparty_commitment_balances(confirm_htlc_spend_first: bo
1197
1255
sorted_vec( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ) ;
1198
1256
1199
1257
connect_blocks ( & nodes[ 1 ] , 1 ) ;
1200
- test_spendable_output ( & nodes[ 1 ] , & as_revoked_txn[ 0 ] ) ;
1258
+ test_spendable_output ( & nodes[ 1 ] , & as_revoked_txn[ 0 ] , false ) ;
1201
1259
1202
1260
let mut payment_failed_events = nodes[ 1 ] . node . get_and_clear_pending_events ( ) ;
1203
1261
expect_payment_failed_conditions_event ( payment_failed_events[ ..2 ] . to_vec ( ) ,
@@ -1206,14 +1264,14 @@ fn do_test_revoked_counterparty_commitment_balances(confirm_htlc_spend_first: bo
1206
1264
dust_payment_hash, false , PaymentFailedConditions :: new ( ) ) ;
1207
1265
1208
1266
connect_blocks ( & nodes[ 1 ] , 1 ) ;
1209
- test_spendable_output ( & nodes[ 1 ] , & claim_txn[ if confirm_htlc_spend_first { 2 } else { 3 } ] ) ;
1267
+ test_spendable_output ( & nodes[ 1 ] , & claim_txn[ if confirm_htlc_spend_first { 2 } else { 3 } ] , false ) ;
1210
1268
connect_blocks ( & nodes[ 1 ] , 1 ) ;
1211
- test_spendable_output ( & nodes[ 1 ] , & claim_txn[ if confirm_htlc_spend_first { 3 } else { 2 } ] ) ;
1269
+ test_spendable_output ( & nodes[ 1 ] , & claim_txn[ if confirm_htlc_spend_first { 3 } else { 2 } ] , false ) ;
1212
1270
expect_payment_failed ! ( nodes[ 1 ] , live_payment_hash, false ) ;
1213
1271
connect_blocks ( & nodes[ 1 ] , 1 ) ;
1214
- test_spendable_output ( & nodes[ 1 ] , & claim_txn[ 0 ] ) ;
1272
+ test_spendable_output ( & nodes[ 1 ] , & claim_txn[ 0 ] , false ) ;
1215
1273
connect_blocks ( & nodes[ 1 ] , 1 ) ;
1216
- test_spendable_output ( & nodes[ 1 ] , & claim_txn[ 1 ] ) ;
1274
+ test_spendable_output ( & nodes[ 1 ] , & claim_txn[ 1 ] , false ) ;
1217
1275
expect_payment_failed ! ( nodes[ 1 ] , timeout_payment_hash, false ) ;
1218
1276
assert_eq ! ( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) , Vec :: new( ) ) ;
1219
1277
@@ -1352,7 +1410,7 @@ fn test_revoked_counterparty_htlc_tx_balances() {
1352
1410
sorted_vec( nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ) ;
1353
1411
1354
1412
connect_blocks ( & nodes[ 0 ] , ANTI_REORG_DELAY - 3 ) ;
1355
- test_spendable_output ( & nodes[ 0 ] , & revoked_local_txn[ 0 ] ) ;
1413
+ test_spendable_output ( & nodes[ 0 ] , & revoked_local_txn[ 0 ] , false ) ;
1356
1414
assert_eq ! ( sorted_vec( vec![ Balance :: CounterpartyRevokedOutputClaimable {
1357
1415
// to_self output to B
1358
1416
amount_satoshis: 10_000 ,
@@ -1365,7 +1423,7 @@ fn test_revoked_counterparty_htlc_tx_balances() {
1365
1423
sorted_vec( nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ) ;
1366
1424
1367
1425
connect_blocks ( & nodes[ 0 ] , 2 ) ;
1368
- test_spendable_output ( & nodes[ 0 ] , & as_htlc_claim_tx[ 0 ] ) ;
1426
+ test_spendable_output ( & nodes[ 0 ] , & as_htlc_claim_tx[ 0 ] , false ) ;
1369
1427
assert_eq ! ( sorted_vec( vec![ Balance :: CounterpartyRevokedOutputClaimable {
1370
1428
// to_self output in B's revoked commitment
1371
1429
amount_satoshis: 10_000 ,
@@ -1432,9 +1490,9 @@ fn test_revoked_counterparty_htlc_tx_balances() {
1432
1490
sorted_vec( nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ) ;
1433
1491
1434
1492
connect_blocks ( & nodes[ 0 ] , ANTI_REORG_DELAY - 2 ) ;
1435
- test_spendable_output ( & nodes[ 0 ] , & as_second_htlc_claim_tx[ 0 ] ) ;
1493
+ test_spendable_output ( & nodes[ 0 ] , & as_second_htlc_claim_tx[ 0 ] , false ) ;
1436
1494
connect_blocks ( & nodes[ 0 ] , 1 ) ;
1437
- test_spendable_output ( & nodes[ 0 ] , & as_second_htlc_claim_tx[ 1 ] ) ;
1495
+ test_spendable_output ( & nodes[ 0 ] , & as_second_htlc_claim_tx[ 1 ] , false ) ;
1438
1496
1439
1497
assert_eq ! ( nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) , Vec :: new( ) ) ;
1440
1498
@@ -1580,7 +1638,7 @@ fn test_revoked_counterparty_aggregated_claims() {
1580
1638
sorted_vec( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ) ;
1581
1639
1582
1640
connect_blocks ( & nodes[ 1 ] , 5 ) ;
1583
- test_spendable_output ( & nodes[ 1 ] , & as_revoked_txn[ 0 ] ) ;
1641
+ test_spendable_output ( & nodes[ 1 ] , & as_revoked_txn[ 0 ] , false ) ;
1584
1642
1585
1643
assert_eq ! ( sorted_vec( vec![ Balance :: CounterpartyRevokedOutputClaimable {
1586
1644
// to_self output in A's revoked commitment
@@ -1612,7 +1670,7 @@ fn test_revoked_counterparty_aggregated_claims() {
1612
1670
sorted_vec( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ) ;
1613
1671
1614
1672
connect_blocks ( & nodes[ 1 ] , 5 ) ;
1615
- test_spendable_output ( & nodes[ 1 ] , & claim_txn_2[ 1 ] ) ;
1673
+ test_spendable_output ( & nodes[ 1 ] , & claim_txn_2[ 1 ] , false ) ;
1616
1674
1617
1675
assert_eq ! ( sorted_vec( vec![ Balance :: CounterpartyRevokedOutputClaimable {
1618
1676
// to_self output in A's revoked commitment
@@ -1636,7 +1694,7 @@ fn test_revoked_counterparty_aggregated_claims() {
1636
1694
1637
1695
connect_blocks ( & nodes[ 1 ] , 5 ) ;
1638
1696
expect_payment_failed ! ( nodes[ 1 ] , revoked_payment_hash, false ) ;
1639
- test_spendable_output ( & nodes[ 1 ] , & claim_txn_2[ 0 ] ) ;
1697
+ test_spendable_output ( & nodes[ 1 ] , & claim_txn_2[ 0 ] , false ) ;
1640
1698
assert ! ( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) . is_empty( ) ) ;
1641
1699
1642
1700
// Ensure that even if we connect more blocks, potentially replaying the entire chain if we're
0 commit comments