Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Real getroutes fixes #7600

Merged

Conversation

rustyrussell
Copy link
Contributor

This actually fixed the issue pointed out by @daywalker90

It's a bit of a hack: I'm assuming that we have some cumulative overflow in our calculations somewhere, as we do use sats not millisats for efficiency.

@rustyrussell rustyrussell added this to the v24.08 milestone Aug 22, 2024
@rustyrussell rustyrussell force-pushed the guilt/getroutes-fixes branch from d995105 to 6f0d8b7 Compare August 22, 2024 07:58
…name.

Based on great test case from https://github.com/daywalker90

```
E       AssertionError: assert {'107x2x0/1': 'Path total 285720859 > spendable 285718000', '108x1x0/1': 'Path total 384721849 > spendable 384718000'} == {}
E         Left contains 2 more items:
E         {'107x2x0/1': 'Path total 285720859 > spendable 285718000',
E          '108x1x0/1': 'Path total 384721849 > spendable 384718000'}
E         Full diff:
E           {
E         -  ,
E         +  '107x2x0/1': 'Path total 285720859 > spendable 285718000',
E         +  '108x1x0/1': 'Path total 384721849 > spendable 384718000',
E           }
```

Signed-off-by: Rusty Russell <[email protected]>
Conversion is lossy, and we don't want to spend more than the channel,
so it's conservative to round down here.

This doesn't actually help our test though!

Signed-off-by: Rusty Russell <[email protected]>
@Lagrang3
Copy link
Collaborator

Yes! We need to consider the cap on the first segment as well.

plugins/askrene/mcf.c Outdated Show resolved Hide resolved
@Lagrang3
Copy link
Collaborator

CI is breaking at tests/test_renepay.py::test_hardmpp2, which is unrelated to these changes.
I think we can disable that test until we figure out what's wrong with it.

@rustyrussell rustyrussell force-pushed the guilt/getroutes-fixes branch from 69084ef to 6359bbb Compare August 22, 2024 23:18
It seems we didn't handle it correctly: we need to cap the first
segment as well as the others, as far as I can tell.

Also, it can be less than the maximum capacity.

Signed-off-by: Rusty Russell <[email protected]>
Of course, we still will, since spendable is for a single HTLC, but
this also shows why we should treat *minimum* as the incorrect answer
if they cross, too.

Signed-off-by: Rusty Russell <[email protected]>
Fixes: ElementsProject#7563
@rustyrussell rustyrussell force-pushed the guilt/getroutes-fixes branch from 6359bbb to e893b74 Compare August 22, 2024 23:34
@rustyrussell rustyrussell merged commit 9d88ce3 into ElementsProject:master Aug 23, 2024
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants