@@ -1295,3 +1295,31 @@ def test_dataloss_protection(node_factory, bitcoind):
12951295
12961296 # l2 should have it in wallet.
12971297 assert (closetxid , "confirmed" ) in set ([(o ['txid' ], o ['status' ]) for o in l2 .rpc .listfunds ()['outputs' ]])
1298+
1299+
1300+ @pytest .mark .xfail (strict = True )
1301+ @unittest .skipIf (not DEVELOPER , "needs dev_disconnect" )
1302+ def test_restart_multi_htlc_rexmit (node_factory , bitcoind , executor ):
1303+ # l1 disables commit timer once we send first htlc, dies on commit
1304+ disconnects = ['=WIRE_UPDATE_ADD_HTLC-nocommit' ,
1305+ '-WIRE_COMMITMENT_SIGNED' ]
1306+ l1 , l2 = node_factory .line_graph (2 , opts = [{'disconnect' : disconnects ,
1307+ 'may_reconnect' : True },
1308+ {'may_reconnect' : True }])
1309+
1310+ executor .submit (l1 .pay , l2 , 20000 )
1311+ executor .submit (l1 .pay , l2 , 30000 )
1312+
1313+ l1 .daemon .wait_for_logs (['peer_out WIRE_UPDATE_ADD_HTLC' ] * 2 )
1314+ l1 .rpc .dev_reenable_commit (l2 .info ['id' ])
1315+ l1 .daemon .wait_for_log ('dev_disconnect: -WIRE_COMMITMENT_SIGNED' )
1316+
1317+ # This will make it reconnect
1318+ l1 .stop ()
1319+ # Clear the disconnect so we can proceed normally
1320+ del l1 .daemon .opts ['dev-disconnect' ]
1321+ l1 .start ()
1322+
1323+ # Payments will fail due to restart, but we can see results in listpayments.
1324+ print (l1 .rpc .listpayments ())
1325+ wait_for (lambda : [p ['status' ] for p in l1 .rpc .listpayments ()['payments' ]] == ['complete' , 'complete' ])
0 commit comments