@@ -381,7 +381,6 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
381
381
route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1_000_000 ) ;
382
382
let error_message = "Channel force-closed" ;
383
383
384
- nodes[ 0 ] . set_channel_signer_available ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, false ) ;
385
384
386
385
if remote_commitment {
387
386
// Make the counterparty broadcast its latest commitment.
@@ -390,6 +389,8 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
390
389
check_closed_broadcast ( & nodes[ 1 ] , 1 , true ) ;
391
390
check_closed_event ( & nodes[ 1 ] , 1 , ClosureReason :: HolderForceClosed , false , & [ nodes[ 0 ] . node . get_our_node_id ( ) ] , 100_000 ) ;
392
391
} else {
392
+ nodes[ 0 ] . set_channel_signer_ops_available ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, ops:: SIGN_HOLDER_COMMITMENT_AND_HTLCS , false ) ;
393
+ nodes[ 0 ] . set_channel_signer_ops_available ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, ops:: SIGN_HOLDER_HTLC_TRANSACTION , false ) ;
393
394
// We'll connect blocks until the sender has to go onchain to time out the HTLC.
394
395
connect_blocks ( & nodes[ 0 ] , TEST_FINAL_CLTV + LATENCY_GRACE_PERIOD_BLOCKS + 1 ) ;
395
396
@@ -398,7 +399,8 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
398
399
assert ! ( nodes[ 0 ] . chain_monitor. chain_monitor. get_and_clear_pending_events( ) . is_empty( ) ) ;
399
400
400
401
// Mark it as available now, we should see the signed commitment transaction.
401
- nodes[ 0 ] . set_channel_signer_available ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, true ) ;
402
+ nodes[ 0 ] . set_channel_signer_ops_available ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, ops:: SIGN_HOLDER_COMMITMENT_AND_HTLCS , true ) ;
403
+ nodes[ 0 ] . set_channel_signer_ops_available ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, ops:: SIGN_HOLDER_HTLC_TRANSACTION , true ) ;
402
404
get_monitor ! ( nodes[ 0 ] , chan_id) . signer_unblocked ( nodes[ 0 ] . tx_broadcaster , nodes[ 0 ] . fee_estimator , & nodes[ 0 ] . logger ) ;
403
405
}
404
406
@@ -424,7 +426,13 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
424
426
425
427
// Mark it as unavailable again to now test the HTLC transaction. We'll mine the commitment such
426
428
// that the HTLC transaction is retried.
427
- nodes[ 0 ] . set_channel_signer_available ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, false ) ;
429
+ let sign_htlc_mask = if remote_commitment {
430
+ ops:: SIGN_COUNTERPARTY_HTLC_TRANSACTION
431
+ } else {
432
+ ops:: SIGN_HOLDER_HTLC_TRANSACTION
433
+ } ;
434
+ nodes[ 0 ] . set_channel_signer_ops_available ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, sign_htlc_mask, false ) ;
435
+ nodes[ 0 ] . set_channel_signer_ops_available ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, ops:: SIGN_HOLDER_ANCHOR_INPUT , false ) ;
428
436
mine_transaction ( & nodes[ 0 ] , & commitment_tx) ;
429
437
430
438
check_added_monitors ( & nodes[ 0 ] , 1 ) ;
@@ -444,7 +452,8 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
444
452
assert ! ( nodes[ 0 ] . tx_broadcaster. txn_broadcast( ) . is_empty( ) ) ;
445
453
446
454
// Mark it as available now, we should see the signed HTLC transaction.
447
- nodes[ 0 ] . set_channel_signer_available ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, true ) ;
455
+ nodes[ 0 ] . set_channel_signer_ops_available ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, sign_htlc_mask, true ) ;
456
+ nodes[ 0 ] . set_channel_signer_ops_available ( & nodes[ 1 ] . node . get_our_node_id ( ) , & chan_id, ops:: SIGN_HOLDER_ANCHOR_INPUT , true ) ;
448
457
get_monitor ! ( nodes[ 0 ] , chan_id) . signer_unblocked ( nodes[ 0 ] . tx_broadcaster , nodes[ 0 ] . fee_estimator , & nodes[ 0 ] . logger ) ;
449
458
450
459
if anchors && !remote_commitment {
@@ -458,9 +467,21 @@ fn do_test_async_holder_signatures(anchors: bool, remote_commitment: bool) {
458
467
}
459
468
460
469
#[ test]
461
- fn test_async_holder_signatures ( ) {
470
+ fn test_async_holder_signatures_no_anchors ( ) {
462
471
do_test_async_holder_signatures ( false , false ) ;
472
+ }
473
+
474
+ #[ test]
475
+ fn test_async_holder_signatures_remote_commitment_no_anchors ( ) {
463
476
do_test_async_holder_signatures ( false , true ) ;
477
+ }
478
+
479
+ #[ test]
480
+ fn test_async_holder_signatures_anchors ( ) {
464
481
do_test_async_holder_signatures ( true , false ) ;
482
+ }
483
+
484
+ #[ test]
485
+ fn test_async_holder_signatures_remote_commitment_anchors ( ) {
465
486
do_test_async_holder_signatures ( true , true ) ;
466
487
}
0 commit comments