@@ -2747,6 +2747,43 @@ def test_shutdown_alternate_txid(node_factory, bitcoind):
2747
2747
wait_for (lambda : l1 .rpc .listpeers ()['peers' ] == [])
2748
2748
2749
2749
2750
+ @unittest .skipIf (not EXPERIMENTAL_FEATURES , "Needs anchor_outputs" )
2751
+ @pytest .mark .developer ("needs to set dev-disconnect" )
2752
+ def test_closing_higherfee (node_factory , bitcoind , executor ):
2753
+ """With anchor outputs we can ask for a *higher* fee than the last commit tx"""
2754
+
2755
+ # We change the feerate before it starts negotiating close, so it aims
2756
+ # for *higher* than last commit tx.
2757
+ l1 , l2 = node_factory .line_graph (2 , opts = [{'may_reconnect' : True ,
2758
+ 'dev-no-reconnect' : None ,
2759
+ 'feerates' : (7500 , 7500 , 7500 , 7500 ),
2760
+ 'disconnect' : ['-WIRE_CLOSING_SIGNED' ]},
2761
+ {'may_reconnect' : True ,
2762
+ 'dev-no-reconnect' : None ,
2763
+ 'feerates' : (7500 , 7500 , 7500 , 7500 )}])
2764
+ # This will trigger disconnect.
2765
+ fut = executor .submit (l1 .rpc .close , l2 .info ['id' ])
2766
+ l1 .daemon .wait_for_log ('dev_disconnect' )
2767
+
2768
+ # Now adjust fees so l1 asks for more on reconnect.
2769
+ l1 .set_feerates ((30000 ,) * 4 , False )
2770
+ l2 .set_feerates ((30000 ,) * 4 , False )
2771
+ l1 .restart ()
2772
+ l2 .restart ()
2773
+ l1 .rpc .connect (l2 .info ['id' ], 'localhost' , l2 .port )
2774
+
2775
+ # This causes us to *exceed* previous requirements!
2776
+ l1 .daemon .wait_for_log (r'deriving max fee from rate 30000 -> 16440sat \(not 1000000sat\)' )
2777
+
2778
+ # This will fail because l1 restarted!
2779
+ with pytest .raises (RpcError , match = r'Connection to RPC server lost.' ):
2780
+ fut .result (TIMEOUT )
2781
+
2782
+ # But we still complete negotiation!
2783
+ wait_for (lambda : only_one (l1 .rpc .listpeers ()['peers' ])['channels' ][0 ]['state' ] == 'CLOSINGD_COMPLETE' )
2784
+ wait_for (lambda : only_one (l2 .rpc .listpeers ()['peers' ])['channels' ][0 ]['state' ] == 'CLOSINGD_COMPLETE' )
2785
+
2786
+
2750
2787
@pytest .mark .developer ("needs dev_disconnect" )
2751
2788
def test_htlc_rexmit_while_closing (node_factory , executor ):
2752
2789
"""Retranmitting an HTLC revocation while shutting down should work"""
0 commit comments