mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-01 17:47:30 +01:00
pytest: Add test for keysend feature support
This commit is contained in:
parent
3b599b846e
commit
5a69b94f9a
1 changed files with 15 additions and 1 deletions
|
@ -2990,13 +2990,22 @@ def test_excluded_adjacent_routehint(node_factory, bitcoind, compat):
|
|||
|
||||
def test_keysend(node_factory):
|
||||
amt = 10000
|
||||
l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True)
|
||||
l1, l2, l3, l4 = node_factory.line_graph(
|
||||
4,
|
||||
wait_for_announce=True,
|
||||
opts=[{}, {}, {}, {'disable-plugin': 'keysend'}]
|
||||
)
|
||||
|
||||
# The keysend featurebit must be set in the announcement, i.e., l1 should
|
||||
# learn that l3 supports keysends.
|
||||
features = l1.rpc.listnodes(l3.info['id'])['nodes'][0]['features']
|
||||
assert(int(features, 16) >> 55 & 0x01 == 1)
|
||||
|
||||
# If we disable keysend, then the featurebit must not be set,
|
||||
# i.e., l4 doesn't support it.
|
||||
features = l1.rpc.listnodes(l4.info['id'])['nodes'][0]['features']
|
||||
assert(int(features, 16) >> 55 & 0x01 == 0)
|
||||
|
||||
# Send an indirect one from l1 to l3
|
||||
l1.rpc.keysend(l3.info['id'], amt)
|
||||
invs = l3.rpc.listinvoices()['invoices']
|
||||
|
@ -3014,6 +3023,11 @@ def test_keysend(node_factory):
|
|||
inv = invs[0]
|
||||
assert(inv['msatoshi_received'] >= amt)
|
||||
|
||||
# And finally try to send a keysend payment to l4, which doesn't
|
||||
# support it. It MUST fail.
|
||||
with pytest.raises(RpcError, match=r"Recipient [0-9a-f]{66} does not support keysend payments"):
|
||||
l3.rpc.keysend(l4.info['id'], amt)
|
||||
|
||||
|
||||
def test_invalid_onion_channel_update(node_factory):
|
||||
'''
|
||||
|
|
Loading…
Add table
Reference in a new issue