Skip to content

Commit 5eb6af5

Browse files
committed
pytest: test if we correctly route using old scids after splice
Spoiler: we don't! Signed-off-by: Rusty Russell <[email protected]>
1 parent 5a98d1b commit 5eb6af5

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/test_splicing.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,3 +424,31 @@ def test_splice_stuck_htlc(node_factory, bitcoind, executor):
424424
# Check that the splice doesn't generate a unilateral close transaction
425425
time.sleep(5)
426426
assert l1.db_query("SELECT count(*) as c FROM channeltxs;")[0]['c'] == 0
427+
428+
429+
@pytest.mark.xfail(strict=True)
430+
def test_route_by_old_scid(node_factory, bitcoind):
431+
l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True, opts={'experimental-splicing': None})
432+
433+
# Get pre-splice route.
434+
inv = l3.rpc.invoice(10000000, 'test_route_by_old_scid', 'test_route_by_old_scid')
435+
route = l1.rpc.getroute(l3.info['id'], 10000000, 1)['route']
436+
437+
# Do a splice
438+
funds_result = l2.rpc.fundpsbt("109000sat", "slow", 166, excess_as_change=True)
439+
chan_id = l2.get_channel_id(l3)
440+
result = l2.rpc.splice_init(chan_id, 100000, funds_result['psbt'])
441+
result = l2.rpc.splice_update(chan_id, result['psbt'])
442+
assert(result['commitments_secured'] is False)
443+
result = l2.rpc.splice_update(chan_id, result['psbt'])
444+
assert(result['commitments_secured'] is True)
445+
result = l2.rpc.signpsbt(result['psbt'])
446+
result = l2.rpc.splice_signed(chan_id, result['signed_psbt'])
447+
448+
wait_for(lambda: only_one(l2.rpc.listpeerchannels(l3.info['id'])['channels'])['state'] == 'CHANNELD_AWAITING_SPLICE')
449+
bitcoind.generate_block(6, wait_for_mempool=1)
450+
wait_for(lambda: only_one(l2.rpc.listpeerchannels(l3.info['id'])['channels'])['state'] == 'CHANNELD_NORMAL')
451+
452+
# Now l1 tries to send using old scid: should work
453+
l1.rpc.sendpay(route, inv['payment_hash'], payment_secret=inv['payment_secret'])
454+
l1.rpc.waitsendpay(inv['payment_hash'])

0 commit comments

Comments
 (0)