@@ -92,9 +92,13 @@ fn chanmon_fail_from_stale_commitment() {
9292 expect_payment_failed_with_update ! ( nodes[ 0 ] , payment_hash, false , update_a. contents. short_channel_id, true ) ;
9393}
9494
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 ) {
9696 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+ }
98102 if let Event :: SpendableOutputs { outputs, .. } = spendable. pop ( ) . unwrap ( ) {
99103 assert_eq ! ( outputs. len( ) , 1 ) ;
100104 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) {
230234 assert_eq ! ( Vec :: <Balance >:: new( ) ,
231235 nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ;
232236
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 ) ;
235239
236240 check_closed_event ! ( nodes[ 0 ] , 1 , ClosureReason :: CooperativeClosure , [ nodes[ 1 ] . node. get_our_node_id( ) ] , 1000000 ) ;
237241 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) {
259263 assert ! ( b_u64 >= a_u64 - 5 ) ;
260264}
261265
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 ) {
263267 // Tests `get_claimable_balances` with an HTLC across a force-close.
264268 // We build a channel with an HTLC pending, then force close the channel and check that the
265269 // `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) {
272276 chanmon_cfgs[ 1 ] . keys_manager . disable_revocation_policy_check = true ;
273277 }
274278 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) ] ) ;
276285 let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
277286
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+
278307 let ( _, _, chan_id, funding_tx) =
279308 create_announced_chan_between_nodes_with_value ( & nodes, 0 , 1 , 1_000_000 , 1_000_000 ) ;
280309 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) {
290319
291320 let htlc_cltv_timeout = nodes[ 0 ] . best_block_info ( ) . 1 + TEST_FINAL_CLTV + 1 ; // Note ChannelManager adds one to CLTV timeouts for safety
292321
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) ;
294323 let channel_type_features = get_channel_type_features ! ( nodes[ 0 ] , nodes[ 1 ] , chan_id) ;
295324
296325 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) {
329358
330359 // Before B receives the payment preimage, it only suggests the push_msat value of 1_000 sats
331360 // 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 } ;
332364 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,
335366 } , sent_htlc_balance. clone( ) , sent_htlc_timeout_balance. clone( ) ] ) ,
336367 sorted_vec( nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ) ;
337368 assert_eq ! ( sorted_vec( vec![ Balance :: ClaimableOnChannelClose {
@@ -371,16 +402,17 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
371402
372403 // Once B has received the payment preimage, it includes the value of the HTLC in its
373404 // "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 ;
374408 let mut a_expected_balances = vec ! [ Balance :: ClaimableOnChannelClose {
375409 amount_satoshis: 1_000_000 - // Channel funding value in satoshis
376410 4_000 - // The to-be-failed HTLC value in satoshis
377411 3_000 - // The claimed HTLC value in satoshis
378412 1_000 - // The push_msat value in satoshis
379413 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
384416 } , sent_htlc_timeout_balance. clone( ) ] ;
385417 if !prev_commitment_tx {
386418 a_expected_balances. push ( sent_htlc_balance. clone ( ) ) ;
@@ -398,13 +430,37 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
398430 mine_transaction ( & nodes[ 0 ] , & remote_txn[ 0 ] ) ;
399431 mine_transaction ( & nodes[ 1 ] , & remote_txn[ 0 ] ) ;
400432
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 ( ) ;
402458 assert_eq ! ( b_broadcast_txn. len( ) , 2 ) ;
403459 // 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 } ) ;
408464 assert_eq ! ( remote_txn[ 0 ] . output[ b_broadcast_txn[ 0 ] . input[ 0 ] . previous_output. vout as usize ] . value, 3_000 ) ;
409465 assert_eq ! ( remote_txn[ 0 ] . output[ b_broadcast_txn[ 1 ] . input[ 0 ] . previous_output. vout as usize ] . value, 4_000 ) ;
410466
@@ -425,10 +481,10 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
425481 // other Balance variants, as close has already happened.
426482 assert ! ( nodes[ 0 ] . chain_monitor. chain_monitor. get_and_clear_pending_events( ) . is_empty( ) ) ;
427483 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 ;
429486 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,
432488 confirmation_height: nodes[ 0 ] . best_block_info( ) . 1 + ANTI_REORG_DELAY - 1 ,
433489 } , sent_htlc_balance. clone( ) , sent_htlc_timeout_balance. clone( ) ] ) ,
434490 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) {
457513 } , received_htlc_claiming_balance. clone( ) , received_htlc_timeout_claiming_balance. clone( ) ] ) ,
458514 sorted_vec( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ) ;
459515
460- test_spendable_output ( & nodes[ 0 ] , & remote_txn[ 0 ] ) ;
516+ test_spendable_output ( & nodes[ 0 ] , & remote_txn[ 0 ] , false ) ;
461517 assert ! ( nodes[ 1 ] . chain_monitor. chain_monitor. get_and_clear_pending_events( ) . is_empty( ) ) ;
462518
463519 // 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) {
504560 nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ;
505561 expect_payment_failed ! ( nodes[ 0 ] , timeout_payment_hash, false ) ;
506562
507- test_spendable_output ( & nodes[ 0 ] , & a_broadcast_txn[ 1 ] ) ;
563+ test_spendable_output ( & nodes[ 0 ] , & a_broadcast_txn[ 1 ] , false ) ;
508564
509565 // Node B will no longer consider the HTLC "contentious" after the HTLC claim transaction
510566 // 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) {
524580 // After reaching the commitment output CSV, we'll get a SpendableOutputs event for it and have
525581 // only the HTLCs claimable on node B.
526582 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 ) ;
528584
529585 assert_eq ! ( sorted_vec( vec![ Balance :: ClaimableAwaitingConfirmations {
530586 amount_satoshis: 3_000 ,
@@ -535,7 +591,7 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
535591 // After reaching the claimed HTLC output CSV, we'll get a SpendableOutptus event for it and
536592 // have only one HTLC output left spendable.
537593 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 ) ;
539595
540596 assert_eq ! ( vec![ received_htlc_timeout_claiming_balance. clone( ) ] ,
541597 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) {
563619
564620#[ test]
565621fn 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 ) ;
568626}
569627
570628#[ test]
@@ -728,13 +786,13 @@ fn test_balances_on_local_commitment_htlcs() {
728786 confirmation_height: node_a_htlc_claimable,
729787 } ] ,
730788 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 ) ;
732790
733791 // Connect blocks until the HTLC-Timeout's CSV expires, providing us the relevant
734792 // `SpendableOutputs` event and removing the claimable balance entry.
735793 connect_blocks ( & nodes[ 0 ] , node_a_htlc_claimable - nodes[ 0 ] . best_block_info ( ) . 1 ) ;
736794 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 ) ;
738796
739797 // Ensure that even if we connect more blocks, potentially replaying the entire chain if we're
740798 // using `ConnectStyle::HighlyRedundantTransactionsFirstSkippingBlocks`, we don't get new
@@ -859,7 +917,7 @@ fn test_no_preimage_inbound_htlc_balances() {
859917
860918 // For node B, we'll get the non-HTLC funds claimable after ANTI_REORG_DELAY confirmations
861919 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 ) ;
863921 bs_pre_spend_claims. retain ( |e| if let Balance :: ClaimableAwaitingConfirmations { .. } = e { false } else { true } ) ;
864922
865923 // 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() {
925983 confirmation_height: core:: cmp:: max( as_timeout_claimable_height, htlc_cltv_timeout) ,
926984 } ] ,
927985 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 ) ;
929987
930988 connect_blocks ( & nodes[ 0 ] , as_timeout_claimable_height - nodes[ 0 ] . best_block_info ( ) . 1 ) ;
931989 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 ) ;
933991
934992 // The process for B should be completely identical as well, noting that the non-HTLC-balance
935993 // was already claimed.
@@ -953,7 +1011,7 @@ fn test_no_preimage_inbound_htlc_balances() {
9531011
9541012 assert_eq ! ( vec![ b_received_htlc_balance. clone( ) ] ,
9551013 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 ) ;
9571015
9581016 connect_blocks ( & nodes[ 1 ] , 1 ) ;
9591017 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
11971255 sorted_vec( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ) ;
11981256
11991257 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 ) ;
12011259
12021260 let mut payment_failed_events = nodes[ 1 ] . node . get_and_clear_pending_events ( ) ;
12031261 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
12061264 dust_payment_hash, false , PaymentFailedConditions :: new ( ) ) ;
12071265
12081266 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 ) ;
12101268 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 ) ;
12121270 expect_payment_failed ! ( nodes[ 1 ] , live_payment_hash, false ) ;
12131271 connect_blocks ( & nodes[ 1 ] , 1 ) ;
1214- test_spendable_output ( & nodes[ 1 ] , & claim_txn[ 0 ] ) ;
1272+ test_spendable_output ( & nodes[ 1 ] , & claim_txn[ 0 ] , false ) ;
12151273 connect_blocks ( & nodes[ 1 ] , 1 ) ;
1216- test_spendable_output ( & nodes[ 1 ] , & claim_txn[ 1 ] ) ;
1274+ test_spendable_output ( & nodes[ 1 ] , & claim_txn[ 1 ] , false ) ;
12171275 expect_payment_failed ! ( nodes[ 1 ] , timeout_payment_hash, false ) ;
12181276 assert_eq ! ( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) , Vec :: new( ) ) ;
12191277
@@ -1352,7 +1410,7 @@ fn test_revoked_counterparty_htlc_tx_balances() {
13521410 sorted_vec( nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ) ;
13531411
13541412 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 ) ;
13561414 assert_eq ! ( sorted_vec( vec![ Balance :: CounterpartyRevokedOutputClaimable {
13571415 // to_self output to B
13581416 amount_satoshis: 10_000 ,
@@ -1365,7 +1423,7 @@ fn test_revoked_counterparty_htlc_tx_balances() {
13651423 sorted_vec( nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ) ;
13661424
13671425 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 ) ;
13691427 assert_eq ! ( sorted_vec( vec![ Balance :: CounterpartyRevokedOutputClaimable {
13701428 // to_self output in B's revoked commitment
13711429 amount_satoshis: 10_000 ,
@@ -1432,9 +1490,9 @@ fn test_revoked_counterparty_htlc_tx_balances() {
14321490 sorted_vec( nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ) ;
14331491
14341492 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 ) ;
14361494 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 ) ;
14381496
14391497 assert_eq ! ( nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) , Vec :: new( ) ) ;
14401498
@@ -1580,7 +1638,7 @@ fn test_revoked_counterparty_aggregated_claims() {
15801638 sorted_vec( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ) ;
15811639
15821640 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 ) ;
15841642
15851643 assert_eq ! ( sorted_vec( vec![ Balance :: CounterpartyRevokedOutputClaimable {
15861644 // to_self output in A's revoked commitment
@@ -1612,7 +1670,7 @@ fn test_revoked_counterparty_aggregated_claims() {
16121670 sorted_vec( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ) ;
16131671
16141672 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 ) ;
16161674
16171675 assert_eq ! ( sorted_vec( vec![ Balance :: CounterpartyRevokedOutputClaimable {
16181676 // to_self output in A's revoked commitment
@@ -1636,7 +1694,7 @@ fn test_revoked_counterparty_aggregated_claims() {
16361694
16371695 connect_blocks ( & nodes[ 1 ] , 5 ) ;
16381696 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 ) ;
16401698 assert ! ( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) . is_empty( ) ) ;
16411699
16421700 // Ensure that even if we connect more blocks, potentially replaying the entire chain if we're
0 commit comments