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

Function test_self_pay

tests/test_pay.py:5126–5145  ·  view source on GitHub ↗

Repro test for issue 4345: pay ourselves via the pay plugin.

(node_factory)

Source from the content-addressed store, hash-verified

5124
5125
5126def test_self_pay(node_factory):
5127 """Repro test for issue 4345: pay ourselves via the pay plugin.
5128
5129 """
5130 l1, l2 = node_factory.line_graph(2, wait_for_announce=True,
5131 opts={'xpay-handle-pay': False,
5132 'allow-deprecated-apis': True})
5133
5134 inv = l1.rpc.invoice(10000, 'test', 'test')['bolt11']
5135 l1.rpc.pay(inv)
5136
5137 # We can pay twice, no problem!
5138 l1.rpc.pay(inv)
5139
5140 inv2 = l1.rpc.invoice(10000, 'test2', 'test2')['bolt11']
5141 l1.rpc.delinvoice('test2', 'unpaid')
5142
5143 with pytest.raises(RpcError, match=r'Unknown invoice') as excinfo:
5144 l1.rpc.pay(inv2)
5145 assert excinfo.value.error['code'] == 203
5146
5147
5148@unittest.skipIf(TEST_NETWORK != 'regtest', "Canned invoice is network specific")

Callers

nothing calls this directly

Calls 4

line_graphMethod · 0.80
delinvoiceMethod · 0.80
invoiceMethod · 0.45
payMethod · 0.45

Tested by

no test coverage detected