Commit graph

1772 commits

Author SHA1 Message Date
Rusty Russell
374db239be Makefile: ensure that cln-grpc depends on msggen generated files.
Looks like a build race, where we use it before it's finished:

```
msggen cln-rpc/src/model.rs
error: this file contains an unclosed delimiter
    --> cln-grpc/src/server.rs:3661:7
     |
84   | {
     | - unclosed delimiter
...
3661 |     }
     |      ^
```
...

```
make: *** [plugins/Makefile:298: target/release/cln-grpc] Error 101
make: *** Waiting for unfinished jobs....
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 14:09:10 +10:30
Jesse de Wit
087a29b0b3 libplugin-pay: trace payment_continue
Changelog-Added: Plugins: `pay` now has tracing support for various payment steps.
2024-11-13 13:15:52 +01:00
Christian Decker
f36be4b006 plugin: Add tracing support for send_outreq
The `send_outreq` function is a good place to suspend and resume
traces, since these are usually the places where we hand off control
back to the `io_loop`. This assumes that we do not continue doing
heavy liftin after we have queued an `outreq` call, but that is most
likely the case anyway. This frees us from having to track suspensions
whenever we call the RPC from a plugin.
2024-11-13 13:15:52 +01:00
Rusty Russell
c31b57c32a plugins/exposesecret: fix for API change.
That will teach me to merge without rebasing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-13 13:24:06 +10:30
Rusty Russell
8293352425 config: add the ability for plugins to specify that config values should be concealed.
And use it for `exposesecret-passphrase`.  This is probably overly
cautious, but it makes me feel a little better that we won't leak it
to someone with read-only access.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-13 08:49:55 +10:30
Rusty Russell
e261301301 exposesecret: new plugin and command to get hsm_secret.
Being able to back up the hsm_secret is critical, but you cannot do
this through a UI, because of course we do not allow such access.
People have lost funds because they didn't back up.

This allows access to the hsm_secret if you use a password set in the
config file.  (If it's not set, the command does not work).  This is a
compromise, of course.

Changelog-Added: `exposesecret` command for encouraging hsm_secret backups.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-13 08:49:55 +10:30
daywalker90
c4e67c0b96 add listing options to listpays
Changelog-Added: JSON-RPC: `listpays` has `index`, `start` and `limit` parameters for listing control.
2024-11-12 10:43:37 +01:00
Rusty Russell
ccd9b21d04 autoclean: rest between cleanup calls.
This means we don't consume *all* the CPU.

Changelog-Fixed: Plugins: `autoclean` is now gentler on the node when doing giant cleans.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-12 10:42:18 +01:00
Rusty Russell
49380239e9 autoclean: don't slam lightningd with 10,000 requests at once.
On a large node, especially with postgres, this causes every other command
to take 30 seconds plus.  The first, obvious, step is to reduce how many
commands we will do at once.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-12 10:42:18 +01:00
evansmj
edc0eb6473 bkpr: add examples for new edit description RPC calls 2024-11-12 09:46:09 +10:30
niftynei
2b4b91ff5c bkpr: add new RPC bkpr-editdescriptionbyoutpoint
Given an {outpoint}, sets the description on the matching outpoint (if exists).

Note that if no outpoint exists in bookkeeper, will return an empty list

Changleog-Added: PLUGINS: bookkeeper has a new RPC `bkrp-editdescriptionbyoutpoint` which will set/update a description for an outpoint creation event.
2024-11-12 09:46:09 +10:30
niftynei
a61b7ef347 bkpr: add new json RPC "bkpr-editdescriptionbypaymentid"
This takes an {payment_id} and {description}.
It looks for all chain + channel events that match
that {payment_id} and updates the description for those events.

We return all the updated events. If no events are updated, an empty
list is returned.

Changelog-Added: PLUGINS: bookkeeper has a new RPC `bkpr-editdescriptionbypaymentid` which will update the description for any event with matching payment_id
2024-11-12 09:46:09 +10:30
niftynei
4a6e014213 bkpr: refactor out the add_events logic for json stuff 2024-11-12 09:46:09 +10:30
jackstar12
bc9834c459 plugins/grpc: grpc-host option
A port should not be opened by default on 0.0.0.0, so change the default
to localhost

Changelog-Added: `grpc-host` option for grpc plugin
2024-11-12 09:43:54 +10:30
jackstar12
1b4e3fff89 plugins/grpc: default value for grpc port
Changelog-Changed: grpc now starts on port 9736 by default
2024-11-12 09:43:54 +10:30
Dusty Daemon
7fd16dc493 splice: Add plugin for magic “splice all” command
The command called “splice” can take a json payload or a ‘splice script’, process it into a list of ‘actions’ and then execute those actions.

These actions include or will include everything you would want to do with a splice:
* Splice into a channel
* Splice out of a channel
* Fund from wallet
* Deposit to wallet
* Send funds to bitcoin address

Changelog-Added: A new magic “splice” command is added that can take a ‘splice script’ or json payload and perform any complex splice across multiple channels merging the result into a single transaction. Some features are disabled and will be added in time.
2024-11-12 06:42:52 +10:30
Rusty Russell
d85dcc0ce4 askrene: persistent layer support.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-08 21:48:55 +10:30
Rusty Russell
b2dcf7248d askrene: add askrene-bias-channel.
This lets you place annotated biases on channels, to influence routing.

Uses include avoiding TOR nodes, slow channels or other local preferences.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-None: askrene is new anyway.
2024-11-08 21:48:55 +10:30
Rusty Russell
3f09e503ec askrene: fix false positive memleak since we didn't scan local_updates.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-08 21:48:55 +10:30
Rusty Russell
5681c088cf libplugin: call get_beglist async, in case they subscribe to the rpc_command hook.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: libplugin: plugins can now intercept `rpc_command` hook without deadlocking.
2024-11-07 17:04:35 +10:30
Rusty Russell
c797b6fb20 libplugin: add method string to jsonrpc callbacks, implement generic helpers.
Without knowing what method was called, we can't have useful general logging
methods, so go through the pain of adding "const char *method" everywhere,
and add:

1. ignore_and_complete - we're done when jsonrpc returned
2. log_broken_and_complete - we're done, but emit BROKEN log.
3. plugin_broken_cb - if this happens, fail the plugin.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-07 17:04:35 +10:30
Rusty Russell
9f92af9fab libplugin: use NULL to imply "take prefix from cmd".
This avoids jsonrpc_request_start() double-evaluating its cmd arg.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-07 17:04:35 +10:30
Rusty Russell
4f4ec9aefd askrene: make sure we depend on libplugin.h
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-07 17:04:35 +10:30
Rusty Russell
c5099b1647 libplugin: clean up API.
When we used to allow cmd to be NULL, we had to hand the plugin
everywhere.  We no longer do.

1. Various jsonrpc_ functions no longer need the plugin arg.
2. send_outreq no longer needs a plugin arg.
3. The init function takes a command, not a plugin.
4. Remove command_deprecated_in_nocmd_ok.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-07 17:04:35 +10:30
Rusty Russell
00d851c792 libplugin: check that command has/hasn't terminated when we get pending/complete.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-07 17:04:35 +10:30
Rusty Russell
6a3e9d91f9 libplugin: insist on always having a non-NULL command context.
And remove command_done() which was used when there was no
cmd.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-07 17:04:35 +10:30
Rusty Russell
bc22a8db4f libplugin-pay: fix command logging
We were dereferencing the first character of the id, (always '"') which meant
everything was id 34.

Before:
	plugin-pay: cmd 34 partid 5

After:
	cmd pytest:pay#62/cln:pay#105 partid 0

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: `pay`: debug logging now uses correct JSON ids.
2024-11-07 17:04:35 +10:30
Rusty Russell
ec8293d215 libplugin-pay: always use a non-NULL struct command.
This means we replace p->cmd with an auxillary command after we've
finished, so we have a valid command to use.

It also means we weave `struct command_result` returns back through
all the callers.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-07 17:04:35 +10:30
Rusty Russell
0a909bdea5 libplugin: reindent.
This does not code changes, but makes the next changes easier.

We short-cut the "we are a child" case and de-indent the main
cases.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-07 17:04:35 +10:30
Rusty Russell
909a9de9fd funder: use auxilliary command instead of NULL command.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-07 17:04:35 +10:30
Rusty Russell
b1e2be3c89 commando: always use proper responses for commands.
All `struct command` should be terminated properly.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-07 17:04:35 +10:30
Rusty Russell
7ce30e2873 libplugin: make timers have a "command" context.
This is cleaner: everything can now be associated with a command
context.

You're supposed to eventually dispose of it using timer_complete().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-07 17:04:35 +10:30
Rusty Russell
45f56f8e5d libplugin: enumerate the specific "struct command" types.
This is clearer than the previous "two booleans".

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-07 17:04:35 +10:30
Rusty Russell
7fe7f49ecf libplugin: always set the "id" field of a command.
We didn't set this previously when it was a notification.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-07 17:04:35 +10:30
Rusty Russell
606aab6f55 libplugin: add aux_command.
Sometimes we want to clean up *after* a command has completed, but
we're moving to a model where all libplugin operations require a
`struct command`.  This adds `aux_command` to create an
independent-lifetime command with the same id.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-07 17:04:35 +10:30
Rusty Russell
c85dd95c12 libplugin: tell compiler that plugin_err is like printf.
And fix the fallout!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-07 17:04:35 +10:30
Lagrang3
ba905f7e20 renepay: add test for description interface
Change-log: renepay: add test for description interface

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2024-11-06 09:59:27 +01:00
Lagrang3
2d9277a9a1 renepay: pay BOLT11 invoices with description_hash
This remove an unnecessary check for existing description field if the
description_hash is provided in the invoice. The bolt11_decode function
already checks the description against the hash if both are provided.

Changelog-Fix: renepay: allow to pay BOLT11 invoices with description_hash, the description field is made optional

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2024-11-06 09:59:27 +01:00
ShahanaFarooqui
555376e5c7 Remove swagger postman screenshots including .github folder
Fixes: https://github.com/ElementsProject/lightning/issues/7691

Changelog-None.
2024-11-06 14:01:22 +10:30
Vincenzo Palazzo
6309503692 bolt12: fix typo about parameters name in err str
Changelog-Fixed: bolt12: fix typo about parameters name in err str
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2024-11-03 21:38:10 +10:30
Joseph Goulden
fe7168b335 build: Exclude python plugins from flake build 2024-10-21 16:56:02 +02:00
ShahanaFarooqui
4f0f84661e release: Update the changelog for point release v24.08.2
Changelog-None.
2024-10-18 09:06:17 -07:00
Rusty Russell
76cfff7533 BOLT update: catch up ("BOLT 4: rename onionmsg_hop to blinded_path_hop")
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-16 07:14:32 +10:30
Rusty Russell
45533584e2 global: rename blinding to path_key everywhere.
Get with the modern nomenclature: the pubkey inside a blinded path is called
the `path_key` now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-16 07:14:32 +10:30
Rusty Russell
9f593a8184 lightningd: update injectonionmessage API to new terminology.
It's not documented, and only used internally, so we don't need a deprecation
cycle.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-16 07:14:32 +10:30
Rusty Russell
014459d893 lightningd: update decryptencrypteddata API to new terminology.
It's not documented, and only used internally, so we don't need a deprecation
cycle.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-16 07:14:32 +10:30
Rusty Russell
fd717c71af global: deprecate old names in JSON fields, add new ones.
Changelog-Added: JSON-RPC: `decode` now used modern BOLT 4 language for blinded paths, `first_path_key`.
Changelog-Deprecated: JSON-RPC: `decode` `blinding` in blinded path: use `first_path_key`.
Changelog-Added: Plugins: `onion_message_recv` and `onion_message_recv_secret` hooks now used modern BOLT 4 language for blinded paths, `first_path_key`.
Changelog-Deprecated: JSON-RPC: `onion_message_recv` and `onion_message_recv_secret` hooks `blinding` in blinded path: use `first_path_key`.
2024-10-16 07:14:32 +10:30
Rusty Russell
dc18f3cd7b BOLTs: update which renames blinding terminology.
No code changes, just catching up with the BOLT changes which rework our
blinded path terminology (for the better!).

Another patch will sweep the rest of our internal names, this tries only to
make things compile and fix up the BOLT quotes.

1. Inside payload: current_blinding_point -> current_path_key
2. Inside update_add_htlc TLV: blinding_point -> blinded_path
3. Inside blinded_path: blinding -> first_path_key
4. Inside onion_message: blinding -> path_key.
5. Inside encrypted_data_tlv: next_blinding_override -> next_path_key_override

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-16 07:14:32 +10:30
Rusty Russell
f944e03fca BOLT update: remove INVALID_REALM error.
This is obsolete (since modern onions) and so removed from spec.
We should not set it, and don't need to handle it specially.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-16 07:14:32 +10:30
Rusty Russell
318e49e9c7 askrene: more logging in explain_failure.
Lagrang3 doesn't like the logging in here at all, but he suggested we at
least be consistent!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-15 09:58:04 +10:30