Askrene and xpay improve#9150
Conversation
|
Overall I like the improvements introduced in this PR. In this way we delegate the interpretation to the moment when we call getroutes: |
9b3f051 to
7bddd3b
Compare
|
bec4e38 to
e65c114
Compare
|
| &scidd, ×tamp, &msat)) { | ||
| /* We don't convert, just omit these */ | ||
| if (!convert_impression) | ||
| copy_data(&out, data_in, olddata - data_in); |
There was a problem hiding this comment.
Is this correct? Why is olddata >= data_in?
I thought wire's cursors moved to greater values after reading.
|
On one commit comment: Ordering is awesome! Besides the fact that impressions being relative do care about order, it can also be argued that "pure constraints" should also because older constraints are less reliable than the more recent. |
f3836ff to
386e3a6
Compare
|
386e3a6 to
f9df6f5
Compare
|
4a0e9e5 to
9083938
Compare
with
|
9083938 to
fe5fb13
Compare
|
84b7e43 to
202f985
Compare
Shades of `efacada7ddf` which did the same thing in multifundchannel:
(ab)used the id, which being a string, gave and id of 34 (").
Also clean up the leftover assert in multifundchannel.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We used to handle it being a literal, but this was removed in 73fc9b0 (v25.05) so we don't need to handle that at all. Not using the raw JSON means we handle weird methodnames by replacement: otherwise we would not match the responses. Only an issue for commando, where the command would time out rather than report "Unknown method". Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…ngs. In particular, "struct jsonrpc_request"'s id is always a string. cmd->id isn't, though. We can also remove the now-unused json_get_id. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We have three uses already, about to add a fourth. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
The prior implementation could read past the end of the buffer (we actually pad our JSON so this isn't harmful, but still). Fix up json_to_s64 and json_to_double too, but since they're not used as often, just copy the string there. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Currently used for offers, we will use it for repeatpay too. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Normal constraints are clamps on min/max caused by failed payments: min for the channels that succeeded, max for the channel which failed. Impressions are the results of successful payments, which alter both min and max (negatively in the forward direction, positively in the reverse). impression: n 1. An effect, feeling, or image retained as a consequence of experience. 2. A vague notion, remembrance, or belief. 3. A mark produced on a surface by pressure. Unlike constraints, this is the result of our own effect on the network: they're related but different enough to get their own API and terminology. The name conveys both we made an impression on the channel, and that the results are a bit vague (due to other changes since then, which we won't know about). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Added: JSON-RPC: `askrene` layers now contain "impressions" representing the effects of successful payments we made through channels.
…n downgrading to v26.06. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
channeld_fakenet sudbdaemon purposedly crafted for this test needs updating to account for funds moving after every success payment. I've tried to fix that but in doing so I also triggered an xpay bug not related to this PR. Therefore, for the moment we skip this test. Changelog-None Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Pure "constraints" don't care about order (they simply clamp max and min), but "impressions" are relative, so they do. Change the hashtable to keep them timestamp sorted. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
from a tal array. Changelog-None Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
On deletion of individual channel intel entries we need to free the pointer inside the structure. Changelog-None Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Use a single realloc to remove old entries. Changelog-None Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
It diagnoses if the *total capacity* of the source/dest are insufficient, but not if the *known capacity* is. So we get: The shortest path is 103x1x0->105x1x0, but 103x1x0/1 layer auto.localchans says max is 77704899msat Whereas it would be better to do: We know from auto.localchans that source has maximum capacity xxx msat (in 1 channels) Similarly for the destination, we get: The shortest path is 103x1x0->105x1x0, but 103x1x0/1 layer auto.localchans says max is 77704899msat
Add PAY_INSUFFICIENT_FUNDS and PAY_ROUTE_NOT_FOUND, and give nice detailed errors for those. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Changed: JSON-RPC: `getroutes` can now return PAY_INSUFFICIENT_FUNDS (215) and PAY_DESTINATION_INSUFFICIENT_CAPACITY (220) error codes.
Changelog-None Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Consider the case in which payment fails due to not enough "known enabled" liquidity. Notice that we cover the "known" and "enabled" cases already. But: known_enabled <= enabled and known_enabled <= known Changelog-None Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
…rrencies. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…ersion. This mirrors the previous commit, where we did it for recurring offers. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Fixed: Offers: we set a 10 minute expiry when we create invoices for offers in other currencies.
We don't actually need to enforce this check here: we can make that the users' responsibility. This simplifies our work quite a lot, since createinvoicerequest won't have to do a lookup any more. This can be done by the repeatpay plugin itself. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This is an undocumented interface, so we can just change it. Rename "recurrence_label" to the more general "label", now we don't require it to find previous payments. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
202f985 to
cd2d6cc
Compare
|
|
Perfect is the enemy of good. I don't want to delay anymore this PR, it is ready for review. I had to skip Also the way impressions move the |
Fix test_explain_source_dest_failure by increasing the amounts by a
factor of ten, which reduces the relative significance of on-chain fees
on the commitment transaction.
This used to fail on liquid-regtest due to insufficient liquidity on
l2->l4 to prevent channel starvation.
At line
```
l1.rpc.xpay(l4.rpc.invoice('30000sat', 'test_explain_simple_failures2', 'test_explain_simple_failures2')['bolt11'])
```
we would get
```
lightningd-2 2026-07-06T11:29:09.973Z DEBUG 02287bfac8b99b35477ebe9334eede1e32b189e24644eb701c079614712331cec0-channeld-chan#3: Adding HTLC would leave us only 19454000msat: we need 25281sat for another HTLC if fees increase from 7500perkw to 13906perkw
lightningd-2 2026-07-06T11:29:09.973Z DEBUG 02287bfac8b99b35477ebe9334eede1e32b189e24644eb701c079614712331cec0-channeld-chan#3: Adding HTLC 0 amount=30000000msat cltv=130 gave CHANNEL_ERR_CHANNEL_CAPACITY_EXCEEDED
```
Changelog-None
Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Depends on #9138
This prepwork for repeatpay improves askrene and xpay: