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

Function test_wait_sendpay

tests/test_pay.py:660–691  ·  view source on GitHub ↗
(node_factory, executor)

Source from the content-addressed store, hash-verified

658
659
660def test_wait_sendpay(node_factory, executor):
661 l1, l2 = node_factory.line_graph(2, fundamount=10**6)
662
663 assert l1.rpc.wait(subsystem='sendpays', indexname='created', nextvalue=0) == {'subsystem': 'sendpays', 'created': 0}
664
665 wait_created = executor.submit(l1.rpc.call, 'wait', {'subsystem': 'sendpays', 'indexname': 'created', 'nextvalue': 1})
666 wait_updated = executor.submit(l1.rpc.call, 'wait', {'subsystem': 'sendpays', 'indexname': 'updated', 'nextvalue': 1})
667 l1.daemon.wait_for_logs(['waiting on sendpays created 1', 'waiting on sendpays updated 1'])
668
669 amt = 200000000
670 inv = l2.rpc.invoice(amt, 'testpayment2', 'desc')
671 routestep = {
672 'amount_msat': amt,
673 'id': l2.info['id'],
674 'delay': 5,
675 'channel': first_scid(l1, l2)
676 }
677 l1.rpc.sendpay([routestep], inv['payment_hash'], payment_secret=inv['payment_secret'])
678 assert wait_created.result(TIMEOUT) == {'subsystem': 'sendpays',
679 'created': 1,
680 'sendpays': {'groupid': 1,
681 'partid': 0,
682 'payment_hash': inv['payment_hash'],
683 'status': 'pending'}}
684 assert wait_updated.result(TIMEOUT) == {'subsystem': 'sendpays',
685 'updated': 1,
686 'sendpays': {'groupid': 1,
687 'partid': 0,
688 'payment_hash': inv['payment_hash'],
689 'status': 'complete'}}
690
691 l1.rpc.waitsendpay(inv['payment_hash'])['payment_preimage']
692
693
694def test_sendpay_onion_overflow(node_factory):

Callers

nothing calls this directly

Calls 7

first_scidFunction · 0.90
line_graphMethod · 0.80
wait_for_logsMethod · 0.80
sendpayMethod · 0.80
waitsendpayMethod · 0.80
waitMethod · 0.45
invoiceMethod · 0.45

Tested by

no test coverage detected