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

988 Commits

Author SHA1 Message Date
jerzybrzoska
caae842bfc
Fix typo: 'them' instead of 'her' (#1005) 2022-06-27 08:24:41 +02:00
Bastien Teinturier
c6c672aa15
Zero-conf typos and clarifications (#998)
A typo wasn't fixed before merging, and there was a confusion between
public and private channels in the rationale for `alias`.
2022-06-20 21:32:00 +02:00
Antoni Spaanderman
0c649ea1c2 Update 03-transactions.md 2022-06-10 19:04:36 +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
7a812cf077 Make zeroconf a channel type, and acceptance indicates trust.
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
Rusty Russell
7aa76b67b2 BOLT 2: add channel_type for option_scid_alias
Allows upgrade in future.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-05-30 20:47:49 +00:00
Rusty Russell
faa6c413b9 BOLT 2: Restore minimum_depth requirement, but explicitly allow 0.
And weaken it: the opener doesn't need to respect it.

Note also that the `funding_locked`-can-change-alias refers to the same peer.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-05-30 20:47:49 +00:00
Rusty Russell
d41cc1ec12 Explicitly allow funding_locked early, and support alias scids.
This lets you add your brand new channel to routehints, and also
means you can use a routehinted channel even if you (later?) have a
real channel.

This supports both trusted and untrusted zero-conf channels: in the
trusted case you can use it immediately like any other channel,
and for the untrusted case you simply use any push_msat they gave you
for outgoing payments, but fail incoming.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-05-30 20:47:49 +00:00
Vincenzo Palazzo
c74a3bbcf8
BOLT 1: introduce port convention for different network (#968)
* bolt1: introduce port convention for different network

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-05-23 13:44:05 -07:00
Matt Corallo
fe96e8fc3d Note that lightning implementations used to skip the msg type bytes
...well, okay, do today, but by the time anyone is reading this
it'll be "used to".
2022-05-19 08:28:31 +02:00
Matt Corallo
de8bb07a65 Clarify how to encode channel_update messages in onions
Apparently not all implementations implemented the onion encoding
the same, causing vastly differing onion failure packets. This
should unify them somewhat.

CC https://github.com/ElementsProject/lightning/issues/5154
2022-05-19 08:28:31 +02:00
Matt Corallo
03468e1756 Clarify what the two flag bytes are in channel_disabled failures
Fixes #791
2022-05-19 08:28:31 +02:00
Vincenzo Palazzo
e7017173d6
bolt2: disallow sending multiple shutdown msg (#977)
The rationale for this is to avoid bad cases like the following one
which was previously allowed:

* sender -> shutdown(script_one) -> receiver
* sender -> shutdown(script_two) -> receiver
* sender <- shutdown(script_one) <- receiver

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-05-18 15:51:37 +02:00
Rusty Russell
105c2e5e9f BOLT 1: make remote_addr definition machine readable.
It had a blank line and invalid format for tools/extract-formats.py.

And move the format information into the requirements section
(and fix spelling: `node_announement` -> `node_announcement`

Diff for extract-formats.py before and after:

```diff
--- /tmp/before	2022-05-17 10:47:01.583086352 +0930
+++ /tmp/after	2022-05-17 10:51:59.166850111 +0930
@@ -6,6 +6,8 @@
 msgdata,init,tlvs,init_tlvs,
 tlvtype,init_tlvs,networks,1
 tlvdata,init_tlvs,networks,chains,chain_hash,...
+tlvtype,init_tlvs,remote_addr,3
+tlvdata,init_tlvs,remote_addr,data,byte,...
 msgtype,error,17
 msgdata,error,channel_id,channel_id,
 msgdata,error,len,u16,
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-05-18 10:15:05 +09:30
Gregory Sanders
c4a0369e70
Make generated pubkeys slightly more grep-able (#988)
* remotepubkey instead of remote_pubkey
* Add a grepable reference of localpubkey usage
2022-05-12 09:19:21 +02:00
Matt Corallo
c1b94dfad1
Merge pull request #981 from TheBlueMatt/2022-4-no-zlib
Remove zlib compression gossip query support
2022-04-25 20:42:49 +00:00
Antoni Spaanderman
2bd5d7e682
Bolt 3: fix broken markdown link (#984) 2022-04-22 13:31:59 +02:00
ziggie1984
71610b06bb
Minor clarification of htlcs to_self_delay (#983)
This is a minor clarification that the `to_self_delay` is enforced
in a 2nd-stage transaction for HTLCs, while it's directly enforced
in the commit tx for the main output.
2022-04-22 09:36:52 +02: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
t-bast
32a76e80c7 Echo channel_type in accept_channel
One argument for adding a feature bit for channel types was to make things
more explicit and remove ambiguity.

When sending `open_channel`, we require funders to include a `channel_type`,
so it would make sense to require fundees to echo that `channel_type`
back to explicitly confirm that they're ok with this `channel_type`.
2022-03-14 14:58:34 -05:00
Rusty Russell
e60d594abf
Fix typo and aspell list. (#963)
Since Travis died, we don't get CI to check these any more :(

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-02-25 12:17:18 +01:00
Bastien Teinturier
5fa6ff3360
Warn on quick close fee mismatch instead of disconnecting (#904)
When peers disagree on the closing fee range, disconnecting
doesn't make sense: upon reconnection they will just send the
same `closing_signed` again.

A warning should instead be sent and logged, so that node
operators can decide to update their fee range if they want
this channel close to make progress.
2022-02-15 08:47:53 +01:00
Ken Sedgwick
d975de1ba5
Clarify the sighash types for HTLC Success and Timeout transactions (#954) 2022-01-31 21:05:20 +01:00
lightning-developer
29db92f334
Removed requirement to broadcast an outdated commitment transaction (#942)
If a node has to fail a channel but knows that its latest commitment transaction is outdated it should not be required to send it but rather wait for the peer to unilaterally close the channel. 

The proposed solution is not so clean because it might produce a deadlock in which two peers assume they have outdated state and send `error` back and forth without actually force closing. Maybe in such a scenario we could create a protocol that mutually closes with split balance? 

Also replaced the word use with broadcast as it seems more accurate.

Co-authored-by: t-bast <bastuc@hotmail.fr>
2022-01-17 20:09:28 +01:00
Matt Corallo
ed7b5f5749
Merge pull request #917 from m-schmoock/bolt1-remote-address
BOLT 1: adds remote address to optional init_tlvs (IP discovery)
2022-01-17 19:05:46 +00:00
Matt Corallo
c878cd8e1d
s/send a warning/warn the user/ in BOLT 5 to avoid confusion (#951)
Prior to the addition of `warning` messages, BOLT 5 specified a
few cases where users should be warned that funds may have been
lost. However, it used the phrasing "send a warning" which can now
be confused  with `warning` messages. Nodes should not generally
inform their counterparty that they have been robbed.
2022-01-17 19:40:47 +01:00
Michael Schmoock
efe9d2d151 BOLT 1: adds remote address to optional init_tlvs
This adds the option to report an remote IP address back to a connecting
peer using the `init` message. A node can decide to use that information
to discover a potential update to its public IPv4 address (NAT) and use
that for a `node_announcement` update message containing the new address.

The proposal includes reporting the IPv4 and IPv6 address,
however in IPv6 there are likely no NAT issues. TOR is skipped for
obvious reasons.

Certain approaches to check and use this information are thinkable:
 - Wait for multiple peers or a certain fraction to report the
   same new address.
 - Check some random node known via gossip to also report the new
   address.
 - Verify this information by making a test connection to itself.
2022-01-07 16:39:19 +01:00
Olaoluwa Osuntokun
ea37941537
anchors: follow up changes after initial zero fee anchors merge (#903)
We can remove references to anchors in a few places, and you need
static key in order to support it, so that reference is redundant.
2022-01-04 09:26:43 +01: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
Matt Corallo
f6c4d76041
Merge pull request #912 from joostjager/custom-invoice-data
Add payment metadata to payment request (feature 48)
2022-01-03 20:18:52 +00:00
Matt Corallo
93909f67f6
Merge pull request #950 from rustyrussell/guilt/soft-errors
Really: BOLT 1: introduce warning messages, reduce requirements to send (hard) errors
2022-01-03 19:36:04 +00:00
Rusty Russell
8032f70f57 BOLT 1: Restore all-zero error semantics
There were valid uses for "I don't want to talk to you anymore" apparently!

Also fixed some tabs -> spaces.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-01-04 05:55:42 +10:30
Joost Jager
2ab3a9f022
Add payment metadata to payment request 2022-01-03 20:09:14 +01:00
Rusty Russell
c36c14d6da BOLT 2: Error instead of warning on shutdown on unopened channel.
Abandoning channel is kinda what they want here.

Reported-by: Matt Corallo
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-12-14 10:32:24 +10:30
Rusty Russell
4fc9f51889 Update 03-transactions.md
Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
2021-12-14 10:32:24 +10:30
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
Rusty Russell
474b68caea BOLT 1: Add warning message, remove "close all" error.
Under this spec, an error with an all-zero channel id is ignored.
Warnings, being odd, will be ignored by older nodes too.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-12-10 04:48:20 +10:30
Matt Corallo
58287e2f5b
Merge pull request #918 from TheBlueMatt/2021-09-drop-ping-rl
Drop ping sending rate-limit suggestion
2021-12-09 18:17:20 +00:00
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
Olaoluwa Osuntokun
630bf989db
BOLT-02+09: introduce feature bit to gate new channel_type feature (#906)
In this commit, we add a new feature bit to gate the new explicit
channel type funding via the new `channel_type` TLV. The addition of
this new bit allows peers to seek out other peers that understand the
new explicit channel negotiation. This is useful in practice, as it
allows peers to avoid needing to "downgrade" the feature bits advertised
at the connection level due to one peer not understanding a new
required feature bit while it has a channel with a connecting peer.

Such a workaround is already deployed on the network between lnd peers
and certain eclair peers, as the `lnd` peers require static key, but the
feature bit is unknown to eclair peers. This situation (forced
downgrade) is undesirable, as until the connected peer updates (or the
channel is closed) and "worst" feature bit set must always be advertised
in order to maintain connectivity.

The other benefit of adding this feature bit is that it allows
implementations to simplify their code by ensuring that the new feature
will be used before sending any messages that include or reference that
feature. Without a feature bit, peers are instead forced to essentially
guess if a peer understands that feature, with logic to be able to "bail
out" of an invalid state.

The addition of this feature bit matches the prior precedent of adding
feature bits when new fields in the channel negotiation message (last
one was upfront shutdown) are added.
2021-12-05 16:35:35 -08:00
Gregory Sanders
6458473336
BOLT01: Switch extension records to unknown fields in test vector (#938)
The test vectors for invalid `init` messages were invalid since we added
the `networks` tlv extension.

They are now fixed and made more future-proof by using tlvs with high
values.
2021-11-29 14:29:09 +01:00
ghost43
0dc3af80ce
Fix typo in name mailing list name (#931) 2021-10-27 15:54:09 +02:00
katesalazar
39806e7d8b
Make Markdown linguist-detectable (#930)
Before this change, repository gets detected as:

Python 51.1%
Shell 48.9%

After this change, repository gets detected as:

Markdown 98.0%
Other 2.0%

This change was added for a cosmetic effect on GitHub, and the line
this change adds can go away if needed.
2021-10-25 20:55:05 +02:00
Bastien Teinturier
86a96ea7c6
Remove link to lightning.network website (#926)
None of the project maintainers have access to that website.

It is completely outdated and could be modified without our consent,
so we shouldn't link to it anymore.
2021-10-19 08:15:02 +02:00
Adam Gibson
3d88d1dd31
Remove stale reference to the gamma key from Bolt 4 (#928)
Fixes #927.
The gamma key was removed from the onion routing spec in 8b29062.

Co-authored-by: Adam Gibson <AdamISZ@protonmail.com>
2021-10-19 08:14:36 +02:00
Bastien Teinturier
8f2104e3b6
Peers need to check each other's dust limit (#894)
Since HTLCs below this amount will not appear in the commitment tx, they
are effectively converted to miner fees. The peer could use this to grief
you by broadcasting its commitment once it contains a lot of dust HTLCs.

Add network dust thresholds computation details, as implemented in Bitcoin
Core's default relay policy.

Drop non-segwit support in shutdown: this allows dust limit to go as low
as 354 sats without creating relay issues with default node policies.

We add a requirement that dust limit cannot be lower than 354 sats.
This ensures implementers don't have to figure this subtlety on their own.

Fixes #696 and #905
2021-10-06 09:40:22 +02:00
Bastien Teinturier
e832059827
Restrict bitcoin amounts (#908)
It doesn't make sense to exchange amounts that exceed the total bitcoin
supply, so let's make that an explicit requirement.
2021-09-28 08:33:27 +02:00