@@ -367,7 +367,6 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
367
367
route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1_000_000 ) ;
368
368
let error_message = "Channel force-closed" ;
369
369
370
- nodes[ 0 ] . set_channel_signer_available ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, false ) ;
371
370
372
371
if remote_commitment {
373
372
// Make the counterparty broadcast its latest commitment.
@@ -376,6 +375,8 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
376
375
check_closed_broadcast ( & nodes[ 1 ] , 1 , true ) ;
377
376
check_closed_event ( & nodes[ 1 ] , 1 , ClosureReason :: HolderForceClosed { broadcasted_latest_txn : Some ( true ) } , false , & [ nodes[ 0 ] . node . get_our_node_id ( ) ] , 100_000 ) ;
378
377
} else {
378
+ nodes[ 0 ] . disable_channel_signer_op ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, SignerOp :: SignHolderCommitment ) ;
379
+ nodes[ 0 ] . disable_channel_signer_op ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, SignerOp :: SignHolderHtlcTransaction ) ;
379
380
// We'll connect blocks until the sender has to go onchain to time out the HTLC.
380
381
connect_blocks ( & nodes[ 0 ] , TEST_FINAL_CLTV + LATENCY_GRACE_PERIOD_BLOCKS + 1 ) ;
381
382
@@ -384,7 +385,8 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
384
385
assert ! ( nodes[ 0 ] . chain_monitor. chain_monitor. get_and_clear_pending_events( ) . is_empty( ) ) ;
385
386
386
387
// Mark it as available now, we should see the signed commitment transaction.
387
- nodes[ 0 ] . set_channel_signer_available ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, true ) ;
388
+ nodes[ 0 ] . enable_channel_signer_op ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, SignerOp :: SignHolderCommitment ) ;
389
+ nodes[ 0 ] . enable_channel_signer_op ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, SignerOp :: SignHolderHtlcTransaction ) ;
388
390
get_monitor ! ( nodes[ 0 ] , chan_id) . signer_unblocked ( nodes[ 0 ] . tx_broadcaster , nodes[ 0 ] . fee_estimator , & nodes[ 0 ] . logger ) ;
389
391
}
390
392
@@ -410,7 +412,13 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
410
412
411
413
// Mark it as unavailable again to now test the HTLC transaction. We'll mine the commitment such
412
414
// that the HTLC transaction is retried.
413
- nodes[ 0 ] . set_channel_signer_available ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, false ) ;
415
+ let sign_htlc_op = if remote_commitment {
416
+ SignerOp :: SignCounterpartyHtlcTransaction
417
+ } else {
418
+ SignerOp :: SignHolderHtlcTransaction
419
+ } ;
420
+ nodes[ 0 ] . disable_channel_signer_op ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, SignerOp :: SignHolderCommitment ) ;
421
+ nodes[ 0 ] . disable_channel_signer_op ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, sign_htlc_op) ;
414
422
mine_transaction ( & nodes[ 0 ] , & commitment_tx) ;
415
423
416
424
check_added_monitors ( & nodes[ 0 ] , 1 ) ;
@@ -427,10 +435,12 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
427
435
if anchors && !remote_commitment {
428
436
handle_bump_htlc_event ( & nodes[ 0 ] , 1 ) ;
429
437
}
430
- assert ! ( nodes[ 0 ] . tx_broadcaster. txn_broadcast( ) . is_empty( ) ) ;
438
+ let txn = nodes[ 0 ] . tx_broadcaster . txn_broadcast ( ) ;
439
+ assert ! ( txn. is_empty( ) , "expected no transaction to be broadcast, got {:?}" , txn) ;
431
440
432
441
// Mark it as available now, we should see the signed HTLC transaction.
433
- nodes[ 0 ] . set_channel_signer_available ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, true ) ;
442
+ nodes[ 0 ] . enable_channel_signer_op ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, SignerOp :: SignHolderCommitment ) ;
443
+ nodes[ 0 ] . enable_channel_signer_op ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, sign_htlc_op) ;
434
444
get_monitor ! ( nodes[ 0 ] , chan_id) . signer_unblocked ( nodes[ 0 ] . tx_broadcaster , nodes[ 0 ] . fee_estimator , & nodes[ 0 ] . logger ) ;
435
445
436
446
if anchors && !remote_commitment {
@@ -444,9 +454,21 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
444
454
}
445
455
446
456
#[ test]
447
- fn test_async_holder_signatures ( ) {
457
+ fn test_async_holder_signatures_no_anchors ( ) {
448
458
do_test_async_holder_signatures ( false , false ) ;
459
+ }
460
+
461
+ #[ test]
462
+ fn test_async_holder_signatures_remote_commitment_no_anchors ( ) {
449
463
do_test_async_holder_signatures ( false , true ) ;
464
+ }
465
+
466
+ #[ test]
467
+ fn test_async_holder_signatures_anchors ( ) {
450
468
do_test_async_holder_signatures ( true , false ) ;
469
+ }
470
+
471
+ #[ test]
472
+ fn test_async_holder_signatures_remote_commitment_anchors ( ) {
451
473
do_test_async_holder_signatures ( true , true ) ;
452
474
}
0 commit comments