Repeatpay: a plugin to handle recurring payments.#9151
Open
rustyrussell wants to merge 30 commits into
Open
Conversation
Avoids having to create a special test plugin most of the time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reduces the number of misc test plugins. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Replace non-standard node variable names (n, n2, node, ln) with l1/l2 across test_plugin.py and test_misc.py. Convert four tests in test_connection.py to use get_nodes() instead of consecutive get_node() calls with identical options (slightly faster). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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>
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). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…n downgrading to v26.06. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
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.
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>
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.
…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>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-EXPERIMENTAL: JSON-RPC: `repeatpay` to make ongoing payments of (draft) recurring offers: also `listrepeatpays`, `amendrepeatpay and `cancelrepeatpay` commands.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Changelog-EXPERIMENTAL: Added `repeatpay` plugin for handling payment of recurring offers.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
I'll admit, I was going to add a list-sendpays-by-label, but Claude came up with "I'll get the invoice from the previous logs" which made me stop for a moment, but then sigh and allow it. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Added: JSON-RPC: `cancelrepeatpay` command to cancel repeaed payments.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #9150
This handles paying recurring payments:
repeatpay <invoice> <maxamount>thenlistrepeatpays,cancelrepeatpayandamendrepeatpay.Since recurring invoices are experimental, this is experimental.