Commit Graph

427 Commits

Author SHA1 Message Date
Rusty Russell
905461f7c4 BOLTs: more catchup ("BOLT 4: More clarifying changes.")
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-16 07:14:32 +10:30
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
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
63f971b892 BOLTs: catchup with "Drop the required channel_update in failure onions".
Not much difference for us.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-16 07:14:32 +10:30
Rusty Russell
3a9536fd37 BOLT catchup: quiescence is included.
This means we should support it by default.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: Protocol: `option_quiesce` enabled by default.
Changelog-Deprecated: Config: --experimental-quiesce: it's now the default.
2024-10-16 07:14:32 +10:30
Rusty Russell
c6be91f8ae wire: add missing patch.
We build with this: it changes the blinded_path field to sciddir_or_pubkey.
But it wasn't committed, so if someone rebuilt the wire files they'd be wrong.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-16 07:14:32 +10:30
Rusty Russell
5bd3d51131 subds: fix case where we keep retrying on EOF.
Our low-level ccan/io IO routines return three values:
-1: error.
0: call me again, I'm not finished.
1: I'm done, go onto the next thing.

In the last release, we tweaked the sematics of "-1": we now opportunistically
call a routine which returns 0 once more, in case there's more data.  We use errno to
distinguish between "EAGAIN" which means there wasn't any data, and real errors.

However, if the underlying read() returns 0 (which it does when the peer has closed
the other end) the value of errno is UNDEFINED.  If it happens to be EAGAIN, we will
call it again, rather than closing.  This causes us to spin: in particular people reported
hsmd consuming 100% of CPU.

The ccan/io read code handled this by setting errno to 0 in this case, but our own
wire low-level routines *did not*.

Fixes: https://github.com/ElementsProject/lightning/issues/7655
Changelog-Fixed: Fixed intermittant bug where hsmd (particularly, but also lightningd) could use 100% CPU.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-09-13 11:13:53 -07:00
Rusty Russell
18fc1b82b0 wire: add new field invreq_paths from spec.
This is the blinded path for offerless invoice_requests.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-08-01 12:31:48 +09:30
Rusty Russell
925e90ee8b wire: rename "offer_node_id" to "offer_issuer_id" to match latest BOLT.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-08-01 12:31:48 +09:30
Rusty Russell
f42e9b3fe6 wire: renumber experimental recurring offer fields.
The `invreq_recurrence_counter` clashes with the coming addition of
invreq_paths, so we might as well move them all to the new experimental
ranges.

Changelog-EXPERIMENTAL: Recurring offers had incompatible changes, won't work against older versions.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-08-01 12:31:48 +09:30
Rusty Russell
c342f204b2 common/wire: update, don't replace fields array in TLV structures.
Regnerating them entirely loses unknown fields.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-07-23 09:54:47 +09:30
Rusty Russell
1e2c6a5837 common: maintain unknown fields when unmarshalling/marshalling TLVs
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-EXPERIMENTAL: offers: maintain unknown fields offers/invoice_requests correctly.
2024-07-23 09:54:47 +09:30
Rusty Russell
21a83a8f79 wire: remove unused obsolete file.
This is from back when we removed EXPERIMENTAL builds.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-07-23 09:54:47 +09:30
Rusty Russell
af90fdc0bb common/utils: macros to help get copy/compare across different types right.
Things are often equivalent but different types:
1. u8 arrays in libwally.
2. sha256
3. Secrets derived via sha256
4. txids

Rather than open-coding a BUILD_ASSERT & memcpy, create a macro to do it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-07-23 09:54:47 +09:30
Rusty Russell
4a78d17748 connectd: do response to gossip queries, don't hand them to gossipd.
This basically means moving the code from gossipd to connectd to handle
these queries.

This will get connectd have finer control over ratelimiting them.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-07-10 12:21:19 +09:30
Rusty Russell
eb1c04ef14 wire: optimize sending packets now we can return EAGAIN.
Interestingly, this patch and the last take my total test time on my
build machine down by about 10%.  From 403.93s (0:06:43) to 366.64s (0:06:06)
though there were some unrelated errors.

Changelog-Changed: connectd: I/O optimizations to significantly speed up larger nodes.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-07-02 15:16:55 -07: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
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
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
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
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
9450d46db1 bitcoin/short_channel_id: pass by copy everywhere.
It's a u64, we should pass by copy.  This is a big sweeping change,
but mainly mechanical (change one, compile, fix breakage, repeat).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-03-20 13:51:48 +10:30
Rusty Russell
be546fc60e Makefiles: remove leftover references to $(EXP)
This was also removed a while ago, it's never set.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-03-20 13:51:48 +10:30
Rusty Russell
df44431f8c common: add tal_arr_eq helper.
We do `memeq(a, tal_bytelen(a), b, tal_bytelen(b))` remarkably often...

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-16 15:02:38 +01:00
niftynei
bc98cafe9e dual-fund: add require_confirmed_inputs to RBF flows
We now require peers to reaffirm their preference for
`require_confirmed_inputs` when executing an RBF.

Requested-By: @t-bast
2024-02-11 10:46:40 +01:00
Rusty Russell
98d2dc2d4c wire: update to BOLT 17ceba42dc6607b637a713a9bc051f63c1357edd "BOLT 4: onion message support."
We don't need to patch it in anymore, now it's merged.  However, we do
move the message itself from onion_wire.csv to peer_wire.csv (we
should get more sophisticated with our parsing, but this works for
now!).

The resulting peer_wire.csv is identical, the onion_wire.csv file is
slightly reordered.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-20 13:56:46 +09:30
Rusty Russell
4413bfa6be wire: update to BOLT aad959a297ff66946effb165518143be15777dd6 "tools: remove option handling now last optional field was removed."
No effect on us, we didn't use this field anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-20 13:56:46 +09:30
Rusty Russell
cfca4e010f common: rename tlv_payload's "blinding_point" to "current_blinding_point" as per spec.
Simple rename in a few internal places.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-20 13:56:46 +09:30
Rusty Russell
cc2c720dd9 wire: fix up messy patches (make extract-onion-csv)
These patches are no longer necessary now blinded payments were
merged into the spec.

However, the spec did rename "blinding_point" inside `payload` to
"current_blinding_point" so we temporarily add a patch to change it back.

You can see wire/onion_wire.csv is reordered, but unchanged.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-20 13:56:46 +09:30
Rusty Russell
232fba878e wire: fix up messy patches (make extract-peer-csv)
They didn't actually apply properly!

I regenerated the dual-funding CSV from the latest commit
(091397fc0798c4b2bdb36dbaa9f5b4b1d4a463e1) and made it a single patch.

I tried doing the same for splicing, but the implementation has drifted
far from the spec, so I simply opted for a patch which didn't change anything.

You can see the resulting "wire/peer_wire.csv" is the same, except fields
are now in a less-random order!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-20 13:56:46 +09:30
Matt Morehouse
4ef718276f wire: correct argument order 2023-09-18 13:58:45 +09:30
Dusty Daemon
4628e3ace8 channeld: Code to implement splicing
Update the lightningd <-> channeld interface with lots of new commands to needed to facilitate spicing.

Implement the channeld splicing protocol leveraging the interactivetx protocol.

Implement lightningd’s channel_control to support channeld in its splicing efforts.

Changelog-Added: Added the features to enable splicing & resizing of active channels.
2023-07-31 21:00:22 +09:30
niftynei
0cd7fe5089 spec: update to latest dual-funding wire changes
the witnesses are maddeningly weird now (you concat everything together)

we also changed some things to be s64's (it's a teeny tiny change)
2023-07-13 19:34:47 +09:30
Dustin Dettmer
aba4d18ed1 signed types: add handlers for signed types
We're adding signed types to the spec! This adds the support mechanisms
for them.
2023-07-13 19:34:47 +09:30
Rusty Russell
e7d4c3175a build: remove --enable-experimental-features / EXPERIMENTAL_FEATURES
Changelog-EXPERIMENTAL: Build: all experimental features are now runtime-enabled; no more ./configure --enable-experimental-features
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-05-23 09:34:08 +09:30
Rusty Russell
4deb552fe9 build: don't generate experimental variants of wire files.
We no longer have any experimental-only wire definitions.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-05-23 09:34:08 +09:30
Rusty Russell
ccf084156d channeld: use explicit --experimental-upgrade flag, not #ifdef EXPERIMENTAL_FEATURES
And no longer insist on opt_quiesce.

Changelog-EXPERIMENTAL: Config: `--experimental-upgrade-protocol` enables simple channel upgrades.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-05-23 09:34:08 +09:30
Rusty Russell
6c23349c72 channeld: allow stfu based on peer features, not EXPERIMENTAL_FEATURES.
Changelog-EXPERIMENTAL: Config: `--experimental-quiesce` enables queiescence, for testing.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-05-23 09:34:08 +09:30
Rusty Russell
e51460be28 wire: remove our own blinded payments patch since it's in spec.
Since this was merged, `make extract-peer-csv` was broken!

But the field names changed:
1. `tlv_update_add_tlvs` -> `tlv_update_add_htlc_tlvs`
2. `blinding` -> `blinding_point`.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-05-23 09:34:08 +09:30
Rusty Russell
15f8e1e63c Makefile: update bolts to 60cfb5972ad4bec4c49ee0f9e729fb3352fcdc6a.
"BOLT 4: Remove legacy format, make var_onion_optin compulsory."

This also renamed the redundant "tlv_payload" to "payload", so we
replace "tlv_tlv_payload" with "tlv_payload" everyhere!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-04-07 21:22:56 +09:30
Rusty Russell
06d42694d5 wire: fix extracted patch.
Too much context, it didn't apply if you try to rebuild from source!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-04-07 21:22:56 +09:30
Rusty Russell
2005ca436e common/gossmap: don't memcpy NULL, 0, and don't add 0 to NULL pointer.
Of course, NULL and length 0 are natural partners, but We Can't Have Nice Things.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-04-05 06:12:24 +09:30
adi2011
66d98c327f peer_wire_is_internal helper.
We are now going to have messages which we know about, but yet we
don't handle ourselves.

[ I reversed this from Adi's, as that was clearer! --RR ]
2023-02-08 08:37:59 -06:00
adi2011
5f481aaf96 wire: Add patch file for peer storage bkp
Add msg type peer_storage and your_peer_storage
2023-02-08 08:37:59 -06:00
niftynei
f465032f6f rfc-dual-fund: update to latest spec for dual-funding
- Renamed zerod_channel_ids to temporary_channel_id
- Renamed witness_stack->witnesses
- Renamed witness_element->witness_elements
- open_channel2 now includes second commitment point
- accept_channel2 now includes second commitment point

Current commit on rfc branch 64f7f360b9f3c2664d078e2129cfe83098fc4617

Changelog-EXPERIMENTAL: Protocol: dual-funding spec changed in incompatible ways, won't work with old versions (but maybe soon with Eclair!!)
2023-02-08 15:04:27 +10:30
niftynei
739d3c7b47 v2 open: if flagged, check that all our inputs are confirmed
not amazing, since we'll probably call openchannel_update multiple
times per open, but this is the simplest way to confirm that we're
not sending unconfirmed outputs to peer.
2023-02-07 21:03:36 -06:00
niftynei
4da0d6230e dual-fund: update to latest, add in updates to rbf amounts
You can now pick a different amount during the RBF phase
2023-02-04 15:31:16 +10:30
Michael Schmoock
ad249607d6 dual-fund: update extracted CSVs to latest bolt draft
Changelog-None
2023-02-04 15:31:16 +10:30
Rusty Russell
da3506e6a0 wire: use correct number of update_add_tlvs blinding field.
See: #5823
Reported-by: @t-bast
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-EXPERIMENTAL: `offers` breaking blinded payments change (update_add_tlvs fix, Eclair compat)
2023-01-30 13:24:29 +10:30