Commit graph

14716 commits

Author SHA1 Message Date
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
Christian Decker
ff0b7488eb pay: Implement offset and chainlag computation when paying
This actually uses the `chainlag` to make unsynced payments possible.
2024-05-08 23:18:27 -05:00
Christian Decker
4d27efc039 pay: Add the chainlag to the payment
The `chainlag` is defined as the positive difference between the
height of the last block processed by the node and the best height
known by the bitcoin backend. The chainlag is positive when we are
still catching up with the blockchain, and `0` otherwise.

The `chainlag` is used as an additional offset to the CLTV values when
sending payments, allowing payments to be sent even before the chain
sync completes.
2024-05-08 23:18:27 -05:00
Christian Decker
a7f4c28f5e pay: Remove the waitheight paymod
It is getting replaced with a paymod that adjusts the chain height
used to offset all calculations from.
2024-05-08 23:18:27 -05:00
Christian Decker
c95b70d52a pytest: Add a test for the height mismatch logic 2024-05-08 23:18:27 -05:00
Lagrang3
7335777595 renepay: fix some memory leaks 2024-05-08 22:32:13 -05:00
Lagrang3
7b18056b09 renepay: fix sources 2024-05-08 22:32:13 -05:00
Lagrang3
985a01b41d renepay: wake-up result collector every 50msec 2024-05-08 22:32:13 -05:00
Lagrang3
014e32ca2f renepay: a bit more verbose information in logs 2024-05-08 22:32:13 -05:00
Lagrang3
e97e6ede41 renepay: update test files 2024-05-08 22:32:13 -05:00
Lagrang3
16d00e09ef renepay: bug fix, local channel information
Listpeerchannels would update the local channel information setting the
liquidity in the outgoing channel to known_min=known_max=capacity,
when in fact it should be known_min=known_max=spendable.
2024-05-08 22:32:13 -05:00
Lagrang3
4adf9b4080 renepay: bug fix on the routebuilder
The route-builder checks the liquidity bounds of each route one at a
time. Every route that satisfy the contraints is recorded in the
uncertainty network and produces an HTLC burden on the channels it uses,
so that the following routes cannot count on the same liquidity twice.
2024-05-08 22:32:13 -05:00
Lagrang3
da00cae30b renepay: remove payment from route
Routes contain only routing information and the payment they're linked
to can be obtained through the payment_hash. We remove the dependency of
route building routines from the payment itself. In order to make
plain payment information available we define a payment_info structure.
2024-05-08 22:32:13 -05:00
Lagrang3
ca2b4e54ae renepay: add disabledmap abstraction
Define a new object called disabledmap that carries information about
the disabled channels and nodes.
2024-05-08 22:32:13 -05:00
Lagrang3
96bd0e455b renepay: refactor routefail
- use switch case over all possible WIRE_* errors,
- remove the virtual machine for routefail, use a simple two step
  solution: 1. update the gossip and 2. handle error cases
2024-05-08 22:32:13 -05:00
Lagrang3
cafc08be1d renepay: disable channels not in chan_extra_map
Expand the disabled set to include channels that are not present in the
chan_extra_map/uncertainty network.
2024-05-08 22:32:13 -05:00
Lagrang3
d2c44fc3df renepay: add a test for routehints 2024-05-08 22:32:13 -05:00
Lagrang3
761c295199 renepay: uncertainty network update revisited
- Update the uncertainty network with the gossmap+local_gossmods,
- ignore channels that fail to give their capacity.
2024-05-08 22:32:13 -05:00
Lagrang3
9f13621de9 renepay: pay selfpayments on spot
Resolve a selfpayment right from the result of `sendpay` instead of
waiting for the notification.
2024-05-08 22:32:13 -05:00
Lagrang3
fa199e21d2 renepay: minor fixes 2024-05-08 22:32:13 -05:00
Lagrang3
0e2660733f renepay: update unit tests 2024-05-08 22:32:13 -05:00
Lagrang3
13a2828b12 renepay: add a test for concurrent payments 2024-05-08 22:32:13 -05:00
Lagrang3
1ee157f02b renepay: update the Makefile 2024-05-08 22:32:13 -05:00
Lagrang3
cc00d509b1 renepay: add a helper module json.c 2024-05-08 22:32:13 -05:00
Lagrang3
73c6142965 renepay: add error codes
Using enum renepay_errorcode simplifies the low level API of chan_extra and flow.
We can extract information about the nature of a function call failure
from its return value.
2024-05-08 22:32:13 -05:00
Lagrang3
7584629696 renepay: add routefail.c
Routefail consist mainly of an API `routefail_start` that handles the
failure of a forwarding request (encoded in a route). Internally there
is a routefail datastructure that goes through a series of execution
steps, eg. updating the gossmap, updating the uncertainty network, etc.
2024-05-08 22:32:13 -05:00
Lagrang3
480dec58f2 renepay: add routetracker.c
Routetracker is a structure that is used to follow the progress of the
route forwarding requests.
2024-05-08 22:32:13 -05:00
Lagrang3
84651fa4ba renepay: add routebuilder.c
Routebuilder constitute the module that builds the routes we try in the
payment. The public API is simply `get_routes`, it replaces the similar
interface for pay_flows.
2024-05-08 22:32:13 -05:00