Commit Graph

15594 Commits

Author SHA1 Message Date
bstin
fb65ec9063 lightning-hsmtool.8.md: Update documentation showing new method
[ Modified to extend generatehsm --RR ]
2024-11-15 12:48:44 +10:30
Rusty Russell
b7d77b49df hsmtool.c: extend generatehsm to allow command-line args.
Based on the patch by bstin <barry.github@capsmx.com>, which added a separate command,
this simply extends "generatehsm" to allow more options.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: hsmtool: generatehsm can run non-interactive, taking options on the cmdline.
2024-11-15 12:48:44 +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
Jesse de Wit
2c09f9ddf0 trace: trim quotes from tag values 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
d57accfca7 lightningd: wait for onchaind to ack new spends before continuing replay.
Christian noted that if we don't do this we could flood onchaind with messages:
particularly in Greenlight where the HSM (remote) may delay indefinitely, so
onchaind doesn't process messages.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-13 14:44:03 +10:30
Rusty Russell
0dc1c5a061 onchaind: explicit ack for onchaind_spent method.
This means it always tells us explicitly whether to keep watching or not,
and we know it's processed it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-13 14:44:03 +10:30
Rusty Russell
77fdd63c50 lightningd: allow subd_req() to take replycb_data arg.
Useful if it's only to be used for the duration of the callback.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-13 14:44:03 +10:30
Rusty Russell
658cc9db5f gossipd: replay old spent UTXOs when restarting.
This may help the cases we see where gossipd doesn't realize channels
are closed (because of shutdown before it processed the closing).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: `gossipd` will no longer miss some channel closes on restart.
2024-11-13 14:44:03 +10:30
Rusty Russell
a4847b5af4 lightningd: only trim old UTXO entries after gossipd acks block.
If it gets really far behind, then we restart, it could miss some.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-13 14:44:03 +10:30
Rusty Russell
20a41fd798 lightningd: only store channel funding spend txs into db.
Now we do replay, we don't need the others.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-13 14:44:03 +10:30
Rusty Russell
5c81b0c3dc lightningd: use block-at-a-time replay for onchaind on restart.
And we hook in the replay watch code.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: `onchaind` can miss conclusion of final txs in some cases, will now replay independently.
2024-11-13 14:44:03 +10:30
Rusty Russell
b098ff03a5 lightningd: separate code for onchaind watches separate if we're doing replay.
We start by telling onchaind about the funding spend, and anything
which spends it, and it tells us the txids it *doesn't* want to watch
any more.  We're going to use a separate set of watches for the replay
case: this implements that code.

Once we're caught up, we convert any remaining watches to normal ones
to follow future blocks.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-13 14:44:03 +10:30
Rusty Russell
f7f3ebae32 wallet: new routine to simply get the funding spend tx, if known.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-13 14:44:03 +10:30
Rusty Russell
3ad7167cfa fuzz: fix up compilation with hsmtool change.
```
tests/fuzz/fuzz-hsm_encryption.c:28:80: error: passing 'char **' to parameter of type 'const char **' discards qualifiers in nested pointer types [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
                assert(!hsm_secret_encryption_key_with_exitcode(passphrase, &encryption_key, &emsg));
                                                                                             ^~~~~
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-13 13:24:06 +10:30
Rusty Russell
d3ad68c647 pytest: reduce time for askrene test_real_data test.
Timing out under CI (1800 seconds!)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-13 13:24:06 +10:30
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
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