MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_repay

Function test_repay

tests/test_pay.py:638–657  ·  view source on GitHub ↗
(node_factory)

Source from the content-addressed store, hash-verified

636
637
638def test_repay(node_factory):
639 l1, l2 = node_factory.line_graph(2, fundamount=10**6)
640
641 amt = 200000000
642 inv = l2.rpc.invoice(amt, 'testpayment2', 'desc')
643 routestep = {
644 'amount_msat': amt,
645 'id': l2.info['id'],
646 'delay': 5,
647 'channel': first_scid(l1, l2)
648 }
649 l1.rpc.sendpay([routestep], inv['payment_hash'], payment_secret=inv['payment_secret'])
650 l1.daemon.wait_for_log("Sending 200000000msat over 1 hops to deliver 200000000msat")
651 l1.rpc.waitsendpay(inv['payment_hash'])['payment_preimage']
652
653 # Re-attempt is instant
654 assert l1.rpc.sendpay([routestep], inv['payment_hash'], payment_secret=inv['payment_secret'])['status'] == 'complete'
655
656 # Don't re-log that we are sending!
657 assert l1.daemon.is_in_log("Sending 200000000msat over 1 hops to deliver 200000000msat", start=l1.daemon.logsearch_start) is None
658
659
660def test_wait_sendpay(node_factory, executor):

Callers

nothing calls this directly

Calls 7

first_scidFunction · 0.90
line_graphMethod · 0.80
sendpayMethod · 0.80
wait_for_logMethod · 0.80
waitsendpayMethod · 0.80
is_in_logMethod · 0.80
invoiceMethod · 0.45

Tested by

no test coverage detected