Commit Graph

15526 Commits

Author SHA1 Message Date
Rusty Russell
101aeea52c ccan: update to latest version
Gives us more room for user bits in opt.

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
Rusty Russell
ab6f405ae7 common/hsm_encryption: use const char * for errors.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-13 08:49:55 +10:30
Lagrang3
bc419b41a8 lightningd: add option dev-strict-forwarding
Changelog-Add: add option dev-strict-forwarding
2024-11-12 10:44:10 +01:00
Rusty Russell
fcdbbd8534 doc: improve documentation of listpays
1. It's called listpays not listpay.
2. "index" does NOT have a default value (it must be specified if limit or start are used)
3. Note that limit and start have effects on accuracy, since we combine records.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-12 10:43:37 +01:00
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
Rusty Russell
b34adc704b pyln-testing: don't fail to start node if we have no Rust.
No cln-grpc means no "grpc-port" option!  I often test this way, with RUST=0
for speed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-12 09:56:39 +01:00
evansmj
edc0eb6473 bkpr: add examples for new edit description RPC calls 2024-11-12 09:46:09 +10:30
niftynei
7b8d484684 bkpr: add tests for new edit description RPC calls
Lets make sure that edit description works as intended.
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
64b7b98f59 doc: add grpc-host and default grpc-port 2024-11-12 09:43:54 +10:30
jackstar12
0b5944708e tests: adjust cln-grpc tests for new default start 2024-11-12 09:43:54 +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
dd956e2210 splice: reestablish should only assume stfu in one case 2024-11-12 06:42:52 +10:30
Dusty Daemon
fe7ba77234 splice: Add more verbose reestablish debug logging 2024-11-12 06:42:52 +10:30
Dusty Daemon
475d5f8bf9 splice: Abort on insufficent funds
If the user does not supply enough funds treat it as an abort instead of a channel warning.

Also clean up some indentation while we’re there.
2024-11-12 06:42:52 +10:30
Dusty Daemon
14b63d8927 splice: Add test of “splice” script command
Tests that splice-in and splice-out work through the scripting process and confirm the resulting balances are correct.
2024-11-12 06:42:52 +10:30
Dusty Daemon
e4978a4037 splice: Update splice fee maximums
The fee maximum is used to issue a warning to the user their feerate is high in case they accidentally make a large donation to miners.

During python testing the feerates are high on purpose so we raise the warning level to at least the penality feerate.
2024-11-12 06:42:52 +10:30
Dusty Daemon
eb83ab15ae peer_control: Don’t report removed inflights 2024-11-12 06:42:52 +10:30
Dusty Daemon
5b211c0389 splice: Documentation for the “splice” command
Adding schema and documentatino for how to use the scripting portion of the “splice” RPC command.
2024-11-12 06:42:52 +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
Dusty Daemon
7ce0dc6e2e addpsbtoutput: Add serial_id flag
When set this flag tells addpsbtoutput to add the intiator serial_id to the added output.

Changelog-Changed: addpsbtoutput now allows serial_id to be set while adding which is needed for splicing and dual.
2024-11-12 06:42:52 +10:30
Dusty Daemon
8221c96eab addpsbtinput: New RPC command to add funds to a psbt
This is the sister command of addpsbtoutput.

Adds inputs equal to or greater than the amount requests, reservers them, and reports important information back out to the user.

Changelog-Added: New low-level RPC command addpsbtinput to fund PSBTs directly and help with complex splices & dual-opens.
2024-11-12 06:42:52 +10:30
Dusty Daemon
879d1191e8 splice: Bulk channel stfu and abort RPC
The ability to stfu channels in bulk is required to do complex multi channel operations. When stfu’ing in this manner, the available funds at the moment of stfu is returned to the user.

In order to cancel the stfu we also add a bulk tx_abort command.

Changelog-Added: `stfu_channels` and `abort_channels` are added for bulk multi-channel splice commands. These allow the user to pause (and resume) multiple channels in place.
2024-11-12 06:42:52 +10:30
Dusty Daemon
d60e9f342b splice: Extract remote sig from psbt if needed
On certain well timed restarts we lose their siganture from memory and don’t receive it from them. In these cases we can extract it from the PSBT directly.
2024-11-12 06:42:52 +10:30
Dusty Daemon
73ad8eaa31 splice: Allow splice_update to return signatures
This is needed to all multi-channel splices. When channeld can return the signatures to the user (based on signing order precedent), it now does from splice_update.

Additionally, we move sending of the initial psbt from splice_init down to splice_update. This is also necessary for correct psbt diff detection during multi-channel splices.

Changelog-Changed: splice_update can in some cases now return the remotely partiall signed psbt to the user, if so `signtures_secured` will be true.
2024-11-12 06:42:52 +10:30
Dusty Daemon
0d241ee187 psbt: comment typo fix 2024-11-12 06:42:52 +10:30
Dusty Daemon
b03f299c9b splice: Modify splice_signed to work with multiple channels
`splice_signed` now searchs the PSBT for channel ids

Changelog-Changed: `splice_signed` parameters are switched in order to make `channel_id` an optional parameter, enabling multi-splice-signatures.
2024-11-12 06:42:52 +10:30
Dusty Daemon
89b110d085 psbt: Add ability to set channel_ids in psbt globals
Stores an array of channel_ids into the PSBT globals area.

Changelog-None
2024-11-12 06:42:52 +10:30
Dusty Daemon
66fe338290 psbt: Add ability to set global PSBT values
Changelog-None
2024-11-12 06:42:52 +10:30
Dusty Daemon
fa0d9b6d2a psbt: Add ability to extract signature
A routine for getting a signature back out of an input’s list of pending signatures via pubkey search.

This is needed for certain kinds of restarts as we lose our peer’s signature from memory but a copy is kept in the PSBT.
2024-11-12 06:42:52 +10:30
Dusty Daemon
3c01fc240a splice: A splice-script test that tests complex corner cases
A test that puts some advanced and complex scripts into the parser and validates the results that come out.
2024-11-12 06:42:52 +10:30
Dusty Daemon
fb3e72687c splice: Script for complex splices
New compiler for splice scripts that parses splice scripts, validates them, converts them to json and back again.

Changelog-Added: Splice script parser — takes a custom splice query language to bundle multiple complex splices into a single task in a simple way.
2024-11-12 06:42:52 +10:30
Dusty Daemon
60e6f7eb48 mac: build warning about unused result
Changelog-None
2024-11-12 06:42:52 +10:30
Rusty Russell
48f50a26bf askrene: commit to API.
This does not mean it won't change, just that it will be backwards compatible.

Changelog-Added: Plugins: `askrene` which provides `getroutes` and a complete API for adding information in layers.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-08 21:48:55 +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
bd58355729 doc: add lightning-askrene-age to Makefile.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
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
fanquake
23465f06df build: add all-fuzz-programs target
Add a convenience target for building, but not running (i.e check-fuzz),
all fuzz targets.

Signed-off-by: fanquake <fanquake@gmail.com>
2024-11-08 11:13:53 +01:00
Rusty Russell
bfc00bc7f2 lightningd: avoid false memleak positive with rpc_command_hook.
On `dev-memleak`, if someone is using rpc_command_hook, we'll call
it when the hook returns.  But it will see these contexts as a leak.

So attach them to tmpctx (which is excluded from leak detection).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-07 17:04:35 +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