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

Function test_pay_optional_args

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

Source from the content-addressed store, hash-verified

312
313
314def test_pay_optional_args(node_factory):
315 l1, l2 = node_factory.line_graph(2)
316
317 inv1 = l2.rpc.invoice(123000, 'test_pay', 'desc')['bolt11']
318 l1.dev_pay(inv1, label='desc', dev_use_shadow=False)
319 payment1 = l1.rpc.listsendpays(inv1)['payments']
320 assert len(payment1) and payment1[0]['amount_sent_msat'] == 123000
321 assert payment1[0]['label'] == 'desc'
322
323 inv2 = l2.rpc.invoice(321000, 'test_pay2', 'description')['bolt11']
324 l1.dev_pay(inv2, riskfactor=5.0, dev_use_shadow=False)
325 payment2 = l1.rpc.listsendpays(inv2)['payments']
326 assert(len(payment2) == 1)
327 # The pay plugin uses `sendonion` since 0.9.0 and `lightningd` doesn't
328 # learn about the amount we intended to send (that's why we annotate the
329 # root of a payment tree with the bolt11 invoice).
330
331 anyinv = l2.rpc.invoice('any', 'any_pay', 'desc')['bolt11']
332 l1.dev_pay(anyinv, label='desc', amount_msat=500, dev_use_shadow=False)
333 payment3 = l1.rpc.listsendpays(anyinv)['payments']
334 assert len(payment3) == 1
335 assert payment3[0]['label'] == 'desc'
336
337 # Should see 3 completed transactions
338 assert len(l1.rpc.listsendpays()['payments']) == 3
339
340
341@pytest.mark.openchannel('v1')

Callers

nothing calls this directly

Calls 4

line_graphMethod · 0.80
listsendpaysMethod · 0.80
invoiceMethod · 0.45
dev_payMethod · 0.45

Tested by

no test coverage detected