@@ -425,10 +425,11 @@ def test_splice_stuck_htlc(node_factory, bitcoind, executor):
425425
426426@unittest .skipIf (TEST_NETWORK != 'regtest' , 'elementsd doesnt yet support PSBT features we need' )
427427def test_route_by_old_scid (node_factory , bitcoind ):
428- l1 , l2 , l3 = node_factory .line_graph (3 , wait_for_announce = True , opts = {'experimental-splicing' : None })
428+ l1 , l2 , l3 = node_factory .line_graph (3 , wait_for_announce = True , opts = {'experimental-splicing' : None , 'may_reconnect' : True })
429429
430430 # Get pre-splice route.
431431 inv = l3 .rpc .invoice (10000000 , 'test_route_by_old_scid' , 'test_route_by_old_scid' )
432+ inv2 = l3 .rpc .invoice (10000000 , 'test_route_by_old_scid2' , 'test_route_by_old_scid2' )
432433 route = l1 .rpc .getroute (l3 .info ['id' ], 10000000 , 1 )['route' ]
433434
434435 # Do a splice
@@ -449,3 +450,28 @@ def test_route_by_old_scid(node_factory, bitcoind):
449450 # Now l1 tries to send using old scid: should work
450451 l1 .rpc .sendpay (route , inv ['payment_hash' ], payment_secret = inv ['payment_secret' ])
451452 l1 .rpc .waitsendpay (inv ['payment_hash' ])
453+
454+ # Let's splice again, so the original scid is two behind the times.
455+ l3 .fundwallet (200000 )
456+ funds_result = l3 .rpc .fundpsbt ("109000sat" , "slow" , 166 , excess_as_change = True )
457+ chan_id = l3 .get_channel_id (l2 )
458+ result = l3 .rpc .splice_init (chan_id , 100000 , funds_result ['psbt' ])
459+ result = l3 .rpc .splice_update (chan_id , result ['psbt' ])
460+ assert (result ['commitments_secured' ] is False )
461+ result = l3 .rpc .splice_update (chan_id , result ['psbt' ])
462+ assert (result ['commitments_secured' ] is True )
463+ result = l3 .rpc .signpsbt (result ['psbt' ])
464+ result = l3 .rpc .splice_signed (chan_id , result ['signed_psbt' ])
465+
466+ wait_for (lambda : only_one (l2 .rpc .listpeerchannels (l3 .info ['id' ])['channels' ])['state' ] == 'CHANNELD_AWAITING_SPLICE' )
467+ bitcoind .generate_block (6 , wait_for_mempool = 1 )
468+ wait_for (lambda : only_one (l2 .rpc .listpeerchannels (l3 .info ['id' ])['channels' ])['state' ] == 'CHANNELD_NORMAL' )
469+
470+ # Now restart l2, make sure it remembers the original!
471+ l2 .restart ()
472+ l2 .rpc .connect (l1 .info ['id' ], 'localhost' , l1 .port )
473+ l2 .rpc .connect (l3 .info ['id' ], 'localhost' , l3 .port )
474+
475+ wait_for (lambda : only_one (l1 .rpc .listpeers ()['peers' ])['connected' ] is True )
476+ l1 .rpc .sendpay (route , inv2 ['payment_hash' ], payment_secret = inv2 ['payment_secret' ])
477+ l1 .rpc .waitsendpay (inv2 ['payment_hash' ])
0 commit comments