Skip to content

Commit

Permalink
pytest: test for forwarding legacy onion.
Browse files Browse the repository at this point in the history
This fails, because l2 can't decode the onion:

```
lightningd-2 2024-05-28T21:43:35.137Z DEBUG   0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-chan#1: Rejecting their htlc 0 since onion is unprocessable WIRE_INVALID_ONION_HMAC ss=4202c24ea44d9029a2ea3abb24cded51da93164f8bb5cddce9cc824af9945435
```

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell authored and endothermicdev committed May 29, 2024
1 parent 288c474 commit a473217
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/test_pay.py
Original file line number Diff line number Diff line change
Expand Up @@ -5660,3 +5660,32 @@ def test_pay_while_opening_channel(node_factory, bitcoind, executor):
assert only_one(l1.rpc.listpeerchannels(l3.info['id'])['channels'])['state'] == 'OPENINGD'
inv = l2.rpc.invoice(10000, "inv", "inv")
l1.rpc.pay(inv['bolt11'])


@pytest.mark.xfail(strict=True)
def test_pay_legacy_forward(node_factory, bitcoind, executor):
"""We removed legacy in 22.11, and LND will still send them for
route hints! See
https://github.com/lightningnetwork/lnd/issues/8785
"""
l1, l2, l3 = node_factory.line_graph(3, fundamount=10**6, wait_for_announce=True)

inv = l3.rpc.invoice(1000, "inv", "inv")

chanid12 = only_one(l1.rpc.listpeerchannels(l2.info['id'])['channels'])['short_channel_id']
chanid23 = only_one(l2.rpc.listpeerchannels(l3.info['id'])['channels'])['short_channel_id']
route = [{'amount_msat': 1011,
'id': l2.info['id'],
'delay': 20,
'channel': chanid12},
{'amount_msat': 1000,
'id': l3.info['id'],
'delay': 10,
'channel': chanid23}]

l1.rpc.call("sendpay", payload={'route': route,
'payment_hash': inv['payment_hash'],
'payment_secret': inv['payment_secret'],
'dev_legacy_hop': True})
l1.rpc.waitsendpay(inv['payment_hash'])

0 comments on commit a473217

Please sign in to comment.