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

Function test_keysend_maxfee

tests/test_pay.py:3748–3774  ·  view source on GitHub ↗
(node_factory, keysendcmd)

Source from the content-addressed store, hash-verified

3746
3747@pytest.mark.parametrize("keysendcmd", ["keysend", "xkeysend"])
3748def test_keysend_maxfee(node_factory, keysendcmd):
3749 opts = [{}, {'fee-base': 50, 'fee-per-satoshi': 0}, {}]
3750 if keysendcmd == 'keysend':
3751 opts[0]['allow-deprecated-apis'] = True
3752 l1, l2, l3 = node_factory.line_graph(
3753 3,
3754 wait_for_announce=True,
3755 opts=opts,
3756 )
3757
3758 if keysendcmd == 'keysend':
3759 # We should fail because maxfee and exemptfee cannot be set simultaneously.
3760 with pytest.raises(RpcError):
3761 l1.rpc.call(keysendcmd, payload={'destination': l3.info['id'], 'amount_msat': 1, 'maxfee': 1, 'exemptfee': 5000})
3762
3763 # We should fail because maxfee and maxfeepercent cannot be set simultaneously.
3764 with pytest.raises(RpcError):
3765 l1.rpc.call(keysendcmd, payload={'destination': l3.info['id'], 'amount_msat': 1, 'maxfee': 1, 'maxfeepercent': 0.0001})
3766
3767 # We should fail because 50msat base fee on l2 exceeds maxfee of 1msat.
3768 with pytest.raises(RpcError, match='Fee exceeds our fee budget|excessive cost'):
3769 l1.rpc.call(keysendcmd, payload={'destination': l3.info['id'], 'amount_msat': 1, 'maxfee': 1})
3770 assert len(l3.rpc.listinvoices()['invoices']) == 0
3771
3772 # Perform a normal keysend with maxfee.
3773 l1.rpc.call(keysendcmd, payload={'destination': l3.info['id'], 'amount_msat': 1, 'maxfee': 50})
3774 assert len(l3.rpc.listinvoices()['invoices']) == 1
3775
3776
3777@pytest.mark.parametrize("keysendcmd", ["keysend", "xkeysend"])

Callers

nothing calls this directly

Calls 3

line_graphMethod · 0.80
callMethod · 0.45
listinvoicesMethod · 0.45

Tested by

no test coverage detected