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

Function test_listpay_result_with_paymod

tests/test_pay.py:4145–4171  ·  view source on GitHub ↗

The object of this test is to verify the correct behavior of the RPC command listpay e with two different type of payment, such as: keysend (without invoice) and pay (with invoice). l1 -> pay invoice -> l2 l2 -> keysend -> l3

(node_factory, bitcoind, keysendcmd)

Source from the content-addressed store, hash-verified

4143
4144@pytest.mark.parametrize("keysendcmd", ["keysend", "xkeysend"])
4145def test_listpay_result_with_paymod(node_factory, bitcoind, keysendcmd):
4146 """
4147 The object of this test is to verify the correct behavior
4148 of the RPC command listpay e with two different type of
4149 payment, such as: keysend (without invoice) and pay (with invoice).
4150 l1 -> pay invoice -> l2
4151 l2 -> keysend -> l3
4152 """
4153 amount_sat = 10 ** 6
4154
4155 if keysendcmd == 'keysend':
4156 opts = {'allow-deprecated-apis': True}
4157 else:
4158 opts = {}
4159 l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True, opts=opts)
4160
4161 invl2 = l2.rpc.invoice(amount_sat * 2, "inv_l2", "inv_l2")
4162 l1.rpc.pay(invl2['bolt11'])
4163
4164 l2.rpc.call(keysendcmd, payload=[l3.info['id'], amount_sat * 2])
4165
4166 assert 'bolt11' in l1.rpc.listpays()['pays'][0]
4167 assert 'bolt11' not in l2.rpc.listpays()['pays'][0]
4168 assert 'payment_hash' in l2.rpc.listpays()['pays'][0]
4169 assert 'payment_hash' in l1.rpc.listpays()['pays'][0]
4170 assert 'destination' in l1.rpc.listpays()['pays'][0]
4171 assert 'destination' in l2.rpc.listpays()['pays'][0]
4172
4173
4174def test_listsendpays_and_listpays_order(node_factory):

Callers

nothing calls this directly

Calls 5

line_graphMethod · 0.80
listpaysMethod · 0.80
invoiceMethod · 0.45
payMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected