1
0
mirror of https://github.com/lightning/bolts.git synced 2024-11-19 01:50:03 +01:00
Commit Graph

164 Commits

Author SHA1 Message Date
ziggieXXX
0809f77c7b
BOlT07: clarify dont_forward bit use cases. (#1198) 2024-09-18 13:37:56 +02:00
Rusty Russell
fc687e8c76 BOLT 9: Remove initial_routing_sync.
This only had an effect when `gossip_queries` was not negotiated, which is now assumed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-05-20 15:06:27 -05:00
Rusty Russell
fce8bab931 BOLT 9: Assume gossip_queries.
Supported by all but 11 nodes*.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
[* there are 449 three-year old LND nodes which advertize `2200` as their features, which have already been trimmed from most gossip for not having htlc_maximum_msat in their channel_updates]
2024-05-20 15:06:27 -05:00
Bastien Teinturier
5f8fea8dc3
gossip: 12-blocks delay channel closed follow-up (#1156)
We introduced a 12-blocks delay for channel closing in #1004, but we
didn't update the requirement in the section about pruning.
2024-05-07 09:45:44 +02:00
Trigger
60de4a0972
BOLT 7: correct the default min_final_cltv_expiry_delta in routing example (#1143) 2024-02-22 10:01:47 +01:00
Carla Kirk-Cohen
e0995c9b84
bolt07: enforce htlc_maximum_msat >= htlc_minimum_msat (#1089) 2023-06-25 14:35:18 +02:00
Elias Rohrer
25a383af98
Fix short_chanel_id typos (#1087) 2023-06-12 13:23:17 +02:00
Antoni Spaanderman
29c14c6e12 fix typos 2023-03-29 09:09:19 +02:00
Bastien Teinturier
b38156b951
Allow nodes to overshoot final htlc amount and expiry (#1032)
When nodes receive HTLCs, they verify that the contents of those HTLCs
match the intructions that the sender provided in the onion. It is
important to ensure that intermediate nodes and final nodes have similar
requirements, otherwise a malicious intermediate node could easily probe
whether the next node is the final recipient or not.

Unfortunately, the requirements for intermediate nodes were more lenient
than the requirements for final nodes. Intermediate nodes allowed overpaying
and increasing the CLTV expiry, whereas final nodes required a perfect
equality between the HTLC values and the onion values.

This provided a trivial way of probing: when relaying an HTLC, nodes could
relay 1 msat more than what the onion instructed (or increase the outgoing
expiry by 1). If the next node was an intermediate node, they would accept
this HTLC, but if the next node was the recipient, they would reject it.

We update those requirements to fix this probing attack vector.

We also clarify `min_final_cltv_expiry`: this is actually a cltv_expiry_delta,
not an absolute cltv_expiry, so the field name should reflect that.

Recipients require incoming HTLC expiry to comply with that expiry delta.
2022-11-08 08:38:36 +01:00
Bastien Teinturier
16973e2b85
Bolt 7: restore htlc_maximum_msat requirement (#1029)
Requirements for the htlc_maximum_msat field in channel_update were
inadvertently removed by #999 (this PR meant to make this field mandatory,
not removed explanations about what it does).
2022-10-06 09:23:26 +02:00
neil saitug
47d325c6ac
gossip: delay considering a channel edge deleted for 12-blocks (#1004)
Allows us time to propagate a splice update (new channel_announcement)

Suggested-By: @t-bast
Co-Authored: @ddustin
2022-08-15 13:16:35 -07:00
Bastien Teinturier
6fee63fc34
Bolt7: add flag for not forwarding channel updates (#999)
Since #910, nodes are allowed to use aliases instead of real scids. It is
helpful to make it explicit that updates using such aliases must not be
forwarded to other nodes by setting a flag in `channel_update`.

This flag is also generally useful for unannounced channels, regardless
of whether they use an scid alias or not.

We also make the `htlc_maximum_msat` field mandatory: every node on the
network currently sets it, so we can simplify the spec.
2022-08-15 13:14:18 -07:00
Bastien Teinturier
48fed66e26
Clarify Bolt 7 latest channel update pruning (#1014)
This is a follow-up on #1006, which actually created more confusion.
2022-08-15 13:09:40 -07:00
Matt Corallo
38a2b1dfd4
Merge pull request #911 from m-schmoock/bolt7-hostnames
BOLT 7: add gossip address descriptor type DNS hostname
2022-08-02 16:43:11 +00:00
t-bast
074a71f003 Add grace period for older channel parameters
When a node creates a new `channel_update` to change its channel parameters,
it will take some time to propagate through the network and payers may use
older parameters. It is recommended to keep accepting older parameters for a
while to improve payment latency and reliability.
2022-07-18 15:24:28 -05:00
fiatjaf
2ecc091f34
Fix typo in Bolt7: "lastest" channel_update, not "oldest" (#1006) 2022-06-29 14:41:50 +02:00
Matt Corallo
bc86304b4b
Merge pull request #910 from rustyrussell/zeroconf-as-alias
Explicitly allow funding_locked early, and support alias scids (feat 46/47/50/51)
2022-05-30 13:50:25 -07:00
Rusty Russell
34e9cd99db Rename funding_locked to channel_ready.
And `next_per_commitment_point` to explictly `second_per_commitment_point`;
this is particularly important since `channel_ready` can be retransmitted
after the channel has been in use, for example.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-05-30 20:47:49 +00:00
Rusty Russell
f8e5c92fb5 channel_update: make sure we use alias scids correctly.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-05-30 20:47:49 +00:00
Matt Corallo
2e8f2095a3 Remove zlib compression gossip query support
Gossip query compression is not very useful - it was added for
mobile clients to, in theory, sync the gossip data directly from
P2P peers, but to my knowledge no mobile clients actually use it
for that, or at least use it where the gossip *query* data is a
substantial portion of their overall bandwidth usage.

Further, because of the semantics of `gossip_timestamp_filter`, its
impractical to ensure you receive a reliable, full view of the
gossip data without re-downloading large portions of the gossip
data on startup.

Ultimately, gossip queries are a pretty non-optimal method of
synchronizing the gossip data. If someone wants highly optimized
gossip data synchronization a new method based on set
reconciliation needs to be propose.

Finally, the current gossip query encoding semantics do not allow
for negotiation and instead require all lightning implementations
take a zlib dependency in some form or another. Given the recent
zlib decoding memory corruption vulnerability, this seems like an
opportune time to simply remove the zlib support, requiring that
nodes stop sending compressed gossip query data (though they can
support reading such gossip query data as long as they wish).

This is an alternative to the suggested gossip query encoding
support in #825.
2022-04-21 18:23:38 +00:00
Gregory Sanders
cf4fddd99e
Fix routing example: channel_update contains cltv_expiry_delta (#978) 2022-04-15 08:48:41 +02:00
Michael Schmoock
088ac9dc8b BOLT 7: add gossip address descriptor type DNS hostname
This introduces a new gossip address descriptor type used for DNS hostnames.
This is particular useful for dynamic DNS users that want to use their home
ISP connection with changing IP addresses without relying only on TOR.

The `len` field is deliberately encoded with just a byte (u8) since
POSIX hostnames do not exceed 255 bytes in total.
2022-01-03 22:27:53 +01:00
Rusty Russell
eb6f3084c5 Make it explicit when to send warnings, errors, fail channel and close connection.
And make most places warn or error.  Places where we're operating
on a channel tend to be "warn and close connection" since we want to
forget the mistake they just sent, and closing the connection does that.

We now use the same words everywhere:
1. "fail channel" means to go onchain (if necessary).
2. "send `error`" means to send an error message.
3. "send `warning`" means to send a warning message.
4. "close connection" means close the connection.

These are all spelled out explicitly, rather than having "fail channel"
imply sending an error packet, for example.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-12-14 10:32:22 +10:30
Antoine Poinsot
886c8f0d98
gossip: deprecate Tor v2 onion services (#940)
Advise to not include/ignore them in announcements
2021-12-06 09:18:58 +01:00
Rusty Russell
d892c318af
BOLT 7: remove 2^32 restriction from channel_update as well. (#902)
This was missed in #877

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-08-30 18:29:21 +02:00
Bastien Teinturier
edd45ecf22
Gossip queries: sync complete is back (#826)
We previously insisted that `reply_channel_range` messages were not
overlapping: blocks content could not be split across multiple messages.

This made it possible to implicitly figure out when sync was complete, so we
re-purposed the previous `complete` field to a `full_information` field.

We now revert that change to allow blocks to be split across multiple
messages. An explicit flag is thus needed to signal that sync is complete.

Fixes #804
2021-02-15 21:37:06 +01:00
Corné Plooy
13520a0e36 tlvs -> tlv_stream subsitution everywhere 2020-11-09 13:10:22 -06:00
Conner Fromknecht
7e8c478aef BOLT07: prune if oldest channel_update is > 2 weeks old 2020-08-20 14:58:11 +09:30
Rusty Russell
9e8e29af9b
Complete the Fundamental Types. (#778)
* Rename all the 'varint' to 'bigsize'.

Having both is confusing; we chose the name bigsize, so use it
explicitly.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

* BOLT 7: use `byte` instead of `u8`.

`u8` isn't a type; see BOLT #1 "Fundamental Types".

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

* BOLT 1: promote bigsize to a Fundamental Type.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-05-25 22:25:46 +02:00
John Newbery
93e1d304e3 Bolt #7: Maintain node discovery/channel discovery ordering
The introductory paragraph describes node discovery and channel
discovery, but changes the ordering. Keep the same ordering throughout
the paragraph for readability.
2020-05-11 22:30:29 +02:00
John Newbery
f49fb440ee Bolt #7: Update introduction text
'three gossip messages' should refer to node and channel discovery
messages, not just channel discovery messages.
2020-05-11 22:30:29 +02:00
Rusty Russell
d4bafcb67d
Reply channel range simplification (#737)
* Rename `complete` flag to `full_information` and provide rationale

This was confusing: the flag name made implementers *think* they
knew what it was for.

* Insist that reply_channel_range be adjacent and ordered

The current loose constraints causes confusion (and now all major
implementations meet the stricter requirements anyway).

You are allowed to provide more blocks than requested, but you have
to be complete and in order, and each reply has to have some overlap
with the requested range.
2020-03-31 08:56:15 +02:00
Matt Corallo
86c2ebcc59
Allow More than one Address of a given type
Its not uncommon to be multi-homed with different addresses, so we should probably allow nodes to do this. Also, it seems like this is pretty much universally not actually enforced on the network.
2020-02-28 19:54:31 +00:00
Bastien Teinturier
dcbf858397
Clarify numerical comparison of pubkeys (#743)
We are using lexixographic order (which is the same as big-endian
when inputs have the same size, such as compressed public keys).
2020-02-18 09:53:12 +01:00
Rusty Russell
7b0169263e
BOLT 1: add networks to init message. (#682)
Add networks to init message via TLV extension.
This prevents accidentally connecting a testnet node to mainnet or the other way around.
2020-02-18 09:46:58 +01:00
Rusty Russell
458b0d34e1 BOLT 7: be more aggressive about sending our own gossip.
As more nodes on the network use timestamp_filter to block gossip
floods, we've seen some propagation problems.  This should avoid it
(and is implemented now by c-lightning).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-02-03 20:43:38 +01:00
Matt Corallo
5abee4d362 Do not allow routing to a node with unkown feature bits set.
This appears to have been an oversight in the flat features spec,
and is somewhat implicitly relied on for several new feature bits -
if var_onion_optin is set on a node_announcement (its not allowed
on a channel_announcement), then trying to route through that node
using the pre-tlv formt is somewhat nonsensical, and should be
forbidden.
2020-01-06 14:34:37 -05:00
Arvanitis Christos
0fb66ca6cc Minor href fix in Contents of 07-routing-gossip.md (#707) 2019-12-09 19:59:47 +01:00
Rusty Russell
6502e30e8f BOLT 7: always propagate announcements with unknown features.
The feature fields refer to the properties of the channel/node, not the
message itself, so we can still propagate them (and should, to avoid
splitting the network).

If we want to make an incompatible announcement message, we'll use a
different type, or insert an even TLV type.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-11-25 19:34:23 +00:00
Rusty Russell
206084c939 BOLT 9: flatten feature fields.
We simply specify, in each case, where they will appear ("Context").

Because `globalfeatures` is already in use, we fold that into the
renamed `localfeatures` field to unify them (now called `features`),
but dissuade further use.

Note also: we REQUIRE minimal `features` field in
channel_announcement, since otherwise both sides of channel will not
agree and not be able to create their signatures!

Consider these theoretical future features:

`opt_dlog_chan`: a new channel type which uses a new discrete log HTLC
type, but can't support traditional HTLC:

* `init`: presents as odd (optional) or even (if traditional channels
  not supported)
* `node_announcement`: the same as above, so you can seek suitable peers.
* `channel_announcement`: presents as even (compulsory), since users need
  to use the new HTLCs.

`opt_wumbochan`: a node which allows channels > 2^24 satoshis:

* `init`: presents as odd (optional), or maybe even (if you only want
  giant channels)
* `node_announcement`: the same as above, so you can seek suitable peers.
* `channel_announcement`: not present, since size of channel indicates
  capacity.

`opt_wumbohtlc`: a channel which allows HTLCs > 2^32 millisatoshis:

* `init`: presents as odd (optional), or even (compulsory)
* `node_announcement`: the same as above, so you can seek suitable peers.
* `channel_announcement`: odd (optional) since you can use the channel
  without understanding what this option means.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Co-Authored-By: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
2019-11-25 19:34:23 +00:00
darosior
b84d09e076 bolt07: remove trailing tabs
Tabs or spaces ? Spaces seems to largely beat tabs in this files (and more globally in the repo).
2019-11-20 00:15:38 +00:00
Rusty Russell
3154157459 BOLT 7: gossip_query_ex typos. (#673)
* BOLT 7: fix cut & paste typo.

This is `reply_channel_range_tlvs`: `query_channel_range_tlvs` is defined
above.  Somehow this fix got lost in the merge process, and breaks
our spec parsing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

* BOLT 7: add missing `encoding_type` field in query_short_channel_ids_tlvs / reply_channel_range_tlvs

The implementations have it, and the requirements refer to it,
but it's not actually in the description!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

* BOLT 7: clarify specification.

As agreed in http://www.erisian.com.au/meetbot/lightning-dev/2019/lightning-dev.2019-08-05-20.03.html,
checksums are not encoded as encoding_type + byte, but as a straight
array.  Referring to them as `*byte` is thus underspecifying them:
they are literally `*channel_update_checksums`.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-09-30 13:50:47 +02:00
Dimitris Apostolou
3476c9b25a Fix typos 2019-09-26 06:12:41 +00:00
sstone
c8e53fe5bf BOTL 7: fixup: clarify when to reply with a node_announcement
Do not reply with a node_announcement if the query includes an optional query flag that does not request it.
The current wording could be interpreted as "always follow with node announcements whenever
you reply with a channel announcements" which defeats the point of using query flags (if you want the node
announcements just set the corresponding bits).
2019-09-16 22:36:59 +02:00
sstone
30485af1df Define a feature bit for extended gossip queries 2019-09-16 22:36:59 +02:00
Fabrice Drouin
2f3514fe75 TLV Formatting changes
We use the more tool-friendly `...*` description for TLV extensions.
Checksums are now serialized as raw arrays, as using zlib compression here would not help.
2019-09-16 22:36:59 +02:00
sstone
2ba49eb467 Fixup: address review comments 2019-09-16 22:36:59 +02:00
Rusty Russell
9d6f969722 BOLT 7: fixup: specify exactly which version of CRC32.
This is the one in SSE4, FWIW, and the iSCSI RFC contains test
vectors.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-09-16 22:36:59 +02:00
Rusty Russell
62dcf0fced BOLT 7: fixup: add missing encoding_type in checksums_tlv.
Since some can be zero (missing updates), it's probably worth
doing the compression thing optionally.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-09-16 22:36:59 +02:00
Rusty Russell
420d740311 BOLT 7: fix up TLV formatting for modern parser.
Formatting changes only.

This make tools/extract-formats.py work (well, it misses some stuff
until the tlv-testcases merge, but then it's OK).

We use `tlvs` (for tlv stream), and we refer to TLV records as "being
included" rather than re-using the TLV name.

We even use subtypes for the pairs of checksums and timestamps.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-09-16 22:36:59 +02:00