Commit graph

14843 commits

Author SHA1 Message Date
Rusty Russell
541cc9dd1f connectd: fix exhaustion code where we pick random peer.
If we don't find one searching from our random spot in the peer table,
we're supposed to wrap, not crash!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-14 18:16:26 -05:00
ShahanaFarooqui
f474585568 doc: Updating installation instructions for python plugins
Previously, we only had a single python plugin `clnrest` and the instructions were embedded under other heading.

Adding a new heading for python plugins and their installation instructions will make it easier for users to locate them.

Changelog-None.
2024-05-14 21:50:29 +02:00
Ken Sedgwick
cfcdde14d8 hsmd: support HSM_VERSION 6
Changelog-Changed: hsmd: the hsmd now supports HSM_VERSION 6

This is actually optional, everything would be ok leaving native hsmd
support at HSM_VERSION 5 instead.
2024-05-14 10:39:12 -05:00
Ken Sedgwick
eda0b28cbb hsmd: HSM_VERSION 6: get_per_commitment_point never returns secret
Changelog-Changed: hsmd: HSM_VERSION 6: get_per_commitment_point does
not imply index - 2 is revoked, makes it safe to call on any index.
2024-05-14 10:39:12 -05:00
Ken Sedgwick
37fe32aa17 hsmd: make the negotiated hsmd version available to libhsmd
Changelog-None: hsmd internals
2024-05-14 10:39:12 -05:00
Ken Sedgwick
a02cc6441a channeld: split get_per_commitment_point uses into separate functions
Changelog-None: channeld internal

This factoring makes it much clearer which callers only need the pubkey and
which only need the old_secret.

VLS has merged a workaround which prevents crashing when fetching a
per-commitment-point beyond the allowed range (the secret is just not
returned in this case.
https://gitlab.com/lightning-signer/validating-lightning-signer/-/merge_requests/643

In HSM_VERSION 6 the semantic is cleaned up; get_per_commitment_point
never returns a secret and safely be called on any commitment number.
2024-05-14 10:39:12 -05:00
Ken Sedgwick
25312630aa channeld: factor out unneeded make_revocation_msg_from_secret
Changelog-None: internal to channeld

Since we don't need a special path for early old_secrets from validate
we can factor out duplicate code.
2024-05-14 10:39:12 -05:00
Ken Sedgwick
1c65fc2633 hsmd: prune unreachable pre HSM_VERSION 5 code
Changelog-None: shouldn't affect others

HSM_MIN_VERSION is 5 which implies use of
WIRE_HSMD_REVOKE_COMMITMENT_TX; prune branches that can't happen.
2024-05-14 10:39:12 -05:00
Se7enZ
ca4710e942 bcli: Add rpcclienttimeout parameter and use max value of it and retry_timeout 2024-05-13 14:26:24 -05:00
Rusty Russell
86d2478743 common: add unit test for marginal feerate function.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-13 14:06:45 -05:00
Christian Decker
24ec17126c channeld: Adjust the feerate security margin profile
The feerate security margin is a multiplicative factor applied to the
feerate of some transactions in order to guarantee that the
transaction remains publishable and has a sufficient chance of being
confirmed, that we can base some of our decisions on that.

The multiplicative factor is >=1 and was so far a constant 2. This
might have been sensible in the low-fee environment, where the fees
are expected to oscillate, and almost guaranteeing that we will
eventually have rising feerates but in high-fee environments that is
no longer the case, and the 100% margin that the multiplicator 2
brings is excessive. We therefore opt to start out with 100%, then
linearly interpolate up to a given maxfeerate (which does not have to
be a real feerate ever reached, it just indicates the feerate after
which we apply the constant 10% margin.

Fixes #6974
Closes #6976
[Fixed up all the other changes required, including spendable calcualtion
 comments and unit test and pytest tests --RR]
2024-05-13 14:06:45 -05:00
daywalker90
047faf1d34 msggen: add sendinvoice method
Changelog-None
2024-05-13 20:06:40 +02:00
daywalker90
54e1c78e46 msggen: add renepaystatus method
Changelog-None
2024-05-13 20:06:40 +02:00
daywalker90
9538ecccad msggen: add renepay method
Changelog-None
2024-05-13 20:06:40 +02:00
daywalker90
5c0f25f916 msggen: add plugin method
Changelog-None
2024-05-13 20:06:40 +02:00
Rusty Russell
8027922cd4 devtools: make bolt12-cli print blinded paths properly.
Print the first_node_id field, and do it all on one line per path.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-12 19:11:43 -05:00
Rusty Russell
e338452c19 offers: handle scid in blinded reply path first_node_id field.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-EXPERIMENTAL: offers: we now understand blinded paths which use a short-channel-id(+direction) as entry point.
2024-05-12 19:11:43 -05:00
Rusty Russell
cb2c4963f2 bolt12: allow first_node_id in blinded path to be a scid.
We don't actually support it yet, but this threads through the type change,
puts it in "decode" etc.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-12 19:11:43 -05:00
Rusty Russell
1b9b160108 common: move json_to_blinded_path into its own file.
It's fairly obscure, and let's not make everyone link it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-12 19:11:43 -05:00
Rusty Russell
7eb72c5924 plugins/fetchinvoice: remove "blindedpath" command altogether, since we're the only user.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-12 19:11:43 -05:00
Rusty Russell
3e37a755cd lightningd: move undocumented "blindedpath" command into fetchinvoice plugin.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-12 19:11:43 -05:00
Rusty Russell
e30c835f72 common: add sciddir_or_pubkey type.
This is proposed to be added to bolt 12, so we need a type to
represent it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-12 19:11:43 -05:00
Vincenzo Palazzo
081a2eef6c docs: fixing the json response in documentation
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2024-05-09 23:19:29 -05:00
Alex Myers
370eb73775 pytest: fix flake in test_splice_disconnect_sig
This test was failing CI under valgrind.  Allow l1 to process
incoming signatures before killing.
2024-05-09 16:14:23 -05:00
Alex Myers
840374653a pytest: fix flake in test_rbf_non_last_mined
A race condition seemed to be redirecting rpc before bitcoind processed
the second rbf transaction.
2024-05-09 16:14:23 -05:00
Alex Myers
4bcca301b0 pytest: update bookkeeper chan lease fee
Removing the min_witness_weight saves the lessor 6 sats.

lessor's DF tx vout:
"value": 4.99492248   ->   "value": 4.99492254
2024-05-09 16:14:23 -05:00
Alex Myers
231a3bd9e8 pytest: update dual-fund tests
removing min-witness-weight requirement
2024-05-09 16:14:23 -05:00
Alex Myers
db3d9e9250 dualopend: remove min_witness_weight requirement
Also fix move on uninitialized value
2024-05-09 16:14:23 -05:00
Rusty Russell
5d061c4cf4 global: remove tags from BOLT quotes now dual-funding is in master
A few of them had minor wording changes, too.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-09 16:14:23 -05:00
Rusty Russell
68da238b31 multifundchannel: where does this minimum weight appear in the BOLTs?
I can't find such a quote, and I'm not sure if this is correct?

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-09 16:14:23 -05:00
Rusty Russell
7261810bd2 openingd: be more flexible in allowing unknown segwit inputs.
Spec says exactly what to test.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-09 16:14:23 -05:00
Rusty Russell
310f147cc8 lightningd, dualopend: update minimum RBF increment from 1/64 to 1/24.
Seems like the final spec got a bit stricter.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-09 16:14:23 -05:00
Rusty Russell
8b8f703db3 dualopend: make is_dust test match the spec.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-09 16:14:23 -05:00
Rusty Russell
a9dffcb1e4 common: don't set DF feature in invoices.
Merged spec says:

```
| 28/29 | `option_dual_fund`                | Use v2 of channel open, enables dual funding              | IN       |
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-09 16:14:23 -05:00
Rusty Russell
2cb6da14fb BOLT: catch up now Dual-funding is included.
Mainly we don't need to patch the spec anywhere near as much.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-09 16:14:23 -05:00
Rusty Russell
cca784c9d0 BOLT: update to include 2016 for max_htlc_cltv.
And deprecate the --max-locktime-blocks which allows them to set it.

Hilariously, the spec misspells CLTV as CTLV at one point, so we work around it for now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-09 16:14:23 -05:00
Rusty Russell
bbb6fd4413 BOLTs: catch up with minor clarifications.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-09 16:14:23 -05:00
Rusty Russell
ac3c178587 global: fix up quotes which are now in the master branch.
1. onion-message
2. blinded-payments
3. route-blinding
4. channel-type
5. warnings.

Now they'll be checked correctly, and if the spec changes, we'll know
to reexamine this code.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-09 16:14:23 -05:00
Rusty Russell
f0d9fc6b2e pytest: relax test_low_fd_limit for Github CI.
We expect:
	UNUSUAL.*WARNING: we have 1 channels but can file descriptors limited to 65536

We get:
	lightningd: WARNING: we have 1 channels but can file descriptors limited to 32768!

This is strange, since the first line is from Python's hard limit.  Presumably something is restricting the fd limit of children

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-09 01:23:46 -05:00
Rusty Russell
9c9b6dd5f8 lightningd: hell, let's start with 64k fds.
They're cheap.  The 2x channels heuristic is nice, but does assume
they restart every so often.  If someone hits 64k connections I would
like to know anyway!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-09 01:23:46 -05:00
Rusty Russell
80f1063dee lightningd: increase fd limit if we can, to double number of starting channels.
1024 is a common limit, and people are starting to hit that many channels, so we should increase it: twice the number of channels seems reasonable, though we only do this at restart time.

Changelog-Changed: lightningd: we now try to increase the number of file descriptors, if it's less than twice the number of channels at startup (and log if we cannot!).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-09 01:23:46 -05:00
Rusty Russell
d3dbcf03fa channeld: close an unimportant connection when fds get low.
We use a crude heuristic: if we were trying to contact them, it's a
"deliberate" connection, and should be preserved.

Changelog-Changed: connectd: prioritize peers with channels (and log!) if we run low on file descriptors.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-09 01:23:46 -05:00
Rusty Russell
6a648fd2bc connectd: use hash table, not linked list, for connecting structs.
I thought I was going to want to have a convenient way of counting
these, but it turns out unnecessary.  Still, this is slightly more
efficient and simple, so I am including it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-09 01:23:46 -05:00
Rusty Russell
857c0042ef lightningd: log when we fail to get an fd from hsmd.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-09 01:23:46 -05:00
Rusty Russell
3bfe622413 connectd: log when we fail to receive an fd from lightningd.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-09 01:23:46 -05:00
Rusty Russell
c8c87e2bf6 connectd: log if we fail an accept() call.
This can happen if we're totally out of fds, but previously we gave
no log message indicating this!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-09 01:23:46 -05:00
Rusty Russell
c1ee8e4981 ccan: update to get extended ccan/io error callbacks.
So we can log when we hit fd limits on accept/recvmsg.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-09 01:23:46 -05:00
Rusty Russell
f34b63ff4d Typo fixes from Alex's review
Co-authored-by: Alex Myers <95372134+endothermicdev@users.noreply.github.com>
2024-05-08 23:18:27 -05:00
Christian Decker
c5faae4d71 pay: Enable chainlag offset in direct override paymod 2024-05-08 23:18:27 -05:00
Christian Decker
9d8cfcf4cf pytest: Remove outdated tests
These tests were related to sending early payments, and will now fail,
as the underlying behavior changed.
2024-05-08 23:18:27 -05:00