I think Eduardo and I stole all the best bits to make xpay and askrene.
I simply enabled deprecations on all the renepay tests.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This will make life easier when we remove the pay plugin, but also fixes
an issue where `listpays` can indicate ongoing payments are failed,
even though xpay is still working on it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Deprecated: JSON-RPC: `keysend` (use `xkeysend`). `xkeysend` will take over `keysend` in v27.03.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Use xpay and listpays.
Some tests which are pay/paystatus specific simply enabled deprecations.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Deprecated: JSON-RPC: `pay` and `paystatus`: use `xpay`, `listpays` (or `xpay`'s notifications for details of attempts). `pay` will be replaced by `xpay` in v27.03.
If you don't use complex pay options, you can use `invstring` now and when xpay
becomes pay, there's no transition.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: JSON-RPC: `pay` now accepts `invstring` as a parameter name for `bolt11`, to ease transition when xpay takes over in v27.03.
The main change here is the error messages got better. Where that was
the case, and the test was not completely redundant with existing xpay
tests, I explicitly converted to calls to xpay (meaning the tests
will be kept when `pay` is finally removed).
Test changes:
1. deschash checking is old-pay only, keep that there.
2. Add debug logs for checks for using forwarding via scid in injectpaymentonion.
3. Don't assert that not all sendpays should have the invoice string: xpay does not try to be clever there.
4. We no longer check if invoices are already paid before routing, since injectpaymentonion will catch that for us.
5. Removed `test_pay_get_error_with_update` which has xpay equiv.
Changelog-Changed: JSON-RPC: `xpay` now handles `pay` command by default (use `xpay-handle-pay=false` to prevent this)
Changelog-Removed: JSON-RPC: `exclude` parameter to `pay` (when `xpay-handle-pay` is True): craft a layer with desired modifications and pass it to `xpay` `layers`.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: offers: we now use `xpay` not `pay` for paying invoices made with invoicerequest().
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This uses askrene, so it benefits from previous payment experience.
Changelog-Added: JSON-RPC: `xkeysend` command for keysend with modern routing support.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This reflects a long-standing complaint from @lagrang3 when the API
was first implemented, and I should have listened. In particular, the
impedance mismatch with the sendpay API is annoying.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `getroutes` `route` explicit fields `node_id_in`, `node_id_out`, `amount_in_msat`, `amount_out_msat`, `cltv_in`, `cltv_out`.
In implementing shadow, I added a call to payment_log in xpay_core,
which caused a valgrind error because we set unique_id later. This
was a premature optimization, so we didn't assign unique_id for
payments which didn't even start, but it's a footgun, and there are
other (less common) calls to payment_log too early which make the same
mistake.
Simplify: unique_id is assigned at creation.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We would get WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS in this case if
the invoice was unknown, and think it weird because it came from an
intermediate node. In practice the result is the same (as it would remove
the blinded path), but it was misleading.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
The man page says 219, but we didn't return that.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: JSON-RPC: `xpay` now correctly returns error code 219 on already paid invoices (not 218).
BOLT 7 recommends this. pay did it: in fact, pay would also add sats,
but that's much more difficult and fraught, so only do CLTV.
Changelog-Added: Protocol: `xpay` now uses shadow CLTV additions to help mask final destination as per BOLT 7.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Applying it globally as `pay` did risks leaking information, but applying
it for retries doesn't really. And doing that is fairly easy with layers.
Changelog-Added: Protocol: `xpay` will now update for the current payment if it gets a `channel_update` in an error message.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This bring us closer to pay parity, and `localinvreq` is needed for
invoicerequest payments.
Changelog-Added: JSON-RPC: `xpay` now accepts `label` and `localinvreqid` parameters (like `pay`).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This layer predated the maxparts parameter.
Changelog-Deprecated: JSON-RPC: `getroutes` layer `auto.no_mpp_support`: use `maxparts=1` parameter instead (available since v25.09).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
If all channels are disabled, say so clearly. Also reword: it's not
the source or destination which have disabled the channels. While
we're here, remove the double space, lest people think I'm Satoshi.
Before:
Failed after 1 attempts.
Unexpected error (invalid_onion_payload) from final node: disabling 103x1x0/1 for this payment.
Then routing failed: We could not find a usable set of paths. The source has disabled 1 of 1 channels, leaving capacity only 0msat of 1000000000msat.
After:
Failed after 1 attempts.
Unexpected error (invalid_onion_payload) from final node: disabling 103x1x0/1 for this payment.
Then routing failed: We could not find a usable set of paths. All 1 channels to the source are disabled.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
These are useful for the common pattern of "append these bytes to this tal array".
As a bonus, we do memcheck() on all these callers, for extra checking
under valgrind.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
update-mocks searches for prototypes, looking first in the local
directory, then in */*.h, and takes the first. In the case of
plugins/bkpr/test/run-currencyrate_str.c referring to
jsonrpc_request_start_, this means it could get either the one in
libplugin (correct) or the one in lightningd (wrong!), depending on
directory order randomness.
Hack it a bit harder, to look one up from the local dir before */*.h.
This is redundant in most cases, but not for three-deep-nested dirs
like this.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-EXPERIMENTAL: JSON-RPC: `createproof` to create a payment proof for a (successful) BOLT12 payment.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We no longer have offer_recurrence, we have
offer_recurrence_compulsory and offer_recurrence_optional. Decode was
changed in v25.12, but we never properly tested it (recurrence is
experimental, after all).
I opted for simplicity over truth here, and simply modified decode to
match the schema, but add a "compulsory" flag.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We missed this. It's experimental, so no changelog needed.
Spotted-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
The withdraw command was returning an unsigned raw transaction in
its 'tx' response field. This happened because signpsbt_done() used
psbt_txid() to extract utx->tx, which internally calls
wally_psbt_extract() with WALLY_PSBT_EXTRACT_NON_FINAL — stripping
all signature and witness data.
The broadcast itself succeeded because sendpsbt internally finalizes
the PSBT via psbt_final_tx(), but the 'tx' field returned to the
user had empty scriptSigs and no witness data.
This is a regression from 908f834d6 ("Update libwally to 0.8.8,
support PSBTv2") which rewrote psbt_txid() from manually copying
final_scriptsig/redeem_script into the cloned tx, to using
wally_psbt_extract(WALLY_PSBT_EXTRACT_NON_FINAL) which strips all
signing data by design.
Fix by finalizing the signed PSBT in signpsbt_done() and extracting
the fully signed transaction via psbt_final_tx(). The txid
verification still uses psbt_txid() (which is correct for txid
computation since txids exclude witness data).
Fixes: https://github.com/ElementsProject/lightning/issues/8701
Changelog-Fixed: withdraw now returns a fully signed transaction in the `tx` response field.
Signed-off-by: Vincenzo Palazzo <vincenzopalazzo@member.fsf.org>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Node should not store SCB that is older than what we already have.
Changelog-Fixed: Protocol: we now only store the most recent peer backup when recovering from peers.
Adding more information to geremergencyrecoverdata, to let users know if they are using
legacy file format and the list of all the backed up channel ids.
Key Changes:
- Added:
1. can_create_penalty: To let user know if they need to update the file.
2. backed_up_channel_ids: List of all the backed up channels
Changelog-Changed: Made getemergencyrecoverdata more verbose.
There's a new test for bolt12 in commit 7153bed9705d7493 ("BOLT 12:
add test vector for invalid bech32 padding (#1312)") which requires us
to b stricter in decoding.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Claude messed up about half of these: putting them too far from the
appropriate code. After this I did it myself.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Mose of these are from the stricter `...` which won't cross section
boundaries. The listoffers_done doesn't actually need the ellipsis at
all.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We're going to get stricter, so "/* BOLT #N to-local output */" or "/* BOLT11 ... */"
will upset it.
Also remove a stray bare blank line in a BOLT comment block.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
When getting channel balances, we round off the msats for splice script.
Changelog-Fixed: Fix for `splicein`, `spliceout`, and `dev-splice` commands where channel balances included partial sats.