Skip to content

Commit 2c8d9d0

Browse files
committed
pytest: actually test xpay/pay return similarity.
Signed-off-by: Rusty Russell <[email protected]>
1 parent d7adf06 commit 2c8d9d0

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

tests/test_xpay.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,15 +442,27 @@ def test_xpay_takeover(node_factory, executor):
442442

443443
# There's no log for this though!
444444
inv = l3.rpc.invoice(100000, "test_xpay_takeover12", "test_xpay_takeover12")['bolt11']
445-
l1.rpc.pay(inv)
445+
realpay = l1.rpc.pay(inv)
446446
assert not l1.daemon.is_in_log('Redirecting pay->xpay',
447447
start=l1.daemon.logsearch_start)
448448

449449
l1.rpc.setconfig('xpay-handle-pay', True)
450450
inv = l3.rpc.invoice(100000, "test_xpay_takeover13", "test_xpay_takeover13")['bolt11']
451-
l1.rpc.pay(inv)
451+
xpay = l1.rpc.pay(inv)
452452
l1.daemon.wait_for_log('Redirecting pay->xpay')
453453

454+
# They should look the same! Same keys, same types
455+
assert {k: type(v) for k, v in realpay.items()} == {k: type(v) for k, v in xpay.items()}
456+
for f in ('created_at', 'payment_hash', 'payment_preimage'):
457+
del realpay[f]
458+
del xpay[f]
459+
assert xpay == {'amount_msat': 100000,
460+
'amount_sent_msat': 100002,
461+
'destination': l3.info['id'],
462+
'parts': 1,
463+
'status': 'complete'}
464+
assert realpay == xpay
465+
454466
# We get destination and amount_msat in listsendpays and listpays.
455467
ret = only_one(l1.rpc.listsendpays(inv)['payments'])
456468
assert ret['destination'] == l3.info['id']

0 commit comments

Comments
 (0)