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

952 Commits

Author SHA1 Message Date
Joost Jager
484110f6e3
BOLT 04: Onion failure message may be followed by a tlv stream 2022-10-26 12:47:34 +02:00
Joost Jager
786963760a
BOLT 04: remove max hops from test vector
With the tlv payload, the maximum isn't fixed anymore.
2022-10-26 12:47:34 +02:00
Joost Jager
adcd03725c
BOLT 04: remove associated data from test vector
Data is not relevant for failure message generation.
2022-10-26 12:47:33 +02: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
t-bast
7053463bca Update onion test vectors
To only use valid tlv payloads instead of fixed-size legacy ones and
invalid tlv streams.

[ Minor typo change: third payload is 275 not 256 bytes long --RR ]
2022-09-29 12:37:35 +09:30
Rusty Russell
60cfb5972a BOLT 4: Remove legacy format, make var_onion_optin compulsory.
My measurements a few weeks ago reveal that only 5 nodes do not
advertize this feature, of over 17000.  I have a patch to
remove support from c-lightning, too.

[ 6 months later: t-bast notes that they only see 0.2% of htlcs using
  legacy, and my node hasn't seen one for 2 months w/ 12000 htlcs --RR ]

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-09-29 12:37:35 +09:30
Duncan Dean
f32c6ddb5f
bolt3: Clarify order of operations for HTLC amount calculation (#1020)
The order of operations is now more clearly specified as:

HTLC output amount = (`amount_msat` / 1000) - (fees in satoshis) where all
divisions are rounded down.

This is required to avoid issues in rounding if we were to take
HTLC output amount = (`amount_msat` - (`feerate_per_kw` * weight)) / 1000 and
then rounded down.
2022-08-30 17:21:41 +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
eugene
341ec844f1 BOLT#02: clarify coop close requirements
This commit ensures closing_signed can only begin if there are
no dangling commitments. It also clarifies update_fee requirements
if it is sent after shutdown.
2022-07-18 15:35:08 -05: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
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