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

85 Commits

Author SHA1 Message Date
lisa neigut
620b033dd6 routing gossip: clarify what 'redundant' means 2018-10-29 00:17:36 +00:00
lisa neigut
80eed319ab gossip: add additional clarification for 'discard'
It's unclear what it means to `discard` a channel.
This add a clarification that it's related to route-finding.
2018-10-18 05:17:26 +00:00
Matt Corallo
8516beb2c4 Remove padding within node_announcement address data
This optional padding makes it very difficulty to deserialize
node_announcements into internal structs for storage and then
reconstruct the original node_announcement, plus are unused on the
network today and no known implementations construct
node_announcement messages with them.
2018-09-17 19:44:11 +00:00
Matt Corallo
2b253f7a61 Correct fee calculation in BOLT 7
The fee calculation in BOLT 7 appears to imply that proprtional
fees must be paid on the incoming amount, not the to_forward amount

This is inconsistent with what is actually implemented in the
field (which uses amount_to_forward) and also would make
pathfinding more complicated as the fee would depend on itself,
making calculation no longer simple.
2018-09-04 00:38:40 +00:00
Rusty Russell
0bb2739133 BOLT 7: advise against spamming with channel_updates.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-08-24 23:42:56 +02:00
Rusty Russell
b6ae60d241 BOLT 7: add maximum capacity field.
This helps lite nodes a little, but also gives a way of advertising a
lesser capacity than implied onchain.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-08-24 23:42:56 +02:00
Rusty Russell
0891374d47 BOLT 7: split flags field in channel_update.
This is not a semantic change: only the lower two bits were defined.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-08-24 23:42:56 +02:00
ueno
3f2c747955 fix typos 2018-08-07 00:07:42 +00:00
Hajime Yamaguchi
a9195a84d0 BOLT 3/BOLT 7: Fix broken links. 2018-08-07 00:07:26 +00:00
Rusty Russell
fd9da9b95e BOLT 7: Add compressed (zlib) encoding.
[ Note: in retrospect, adding this in the initial draft without its
  own feature bit was a mistake.  It was a premature optimization,
  adds complexity and removes the ability to disable it if a problem
  is found without disabling gossip_queries entirely.  However, it
  is already deployed as-is. --RR ]
  
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-06-28 00:21:23 +00:00
Rusty Russell
f6312d9a70 BOLT 7: query_messages option.
[ This was a joint effort by many people, with iterations not
  indicated in this final commit: thanks to all who reviewed and
  polished!  Particularly: @jimpo @cdecker @sstone @ZmnSCPxj ]

This enables three new functions:

1. query_short_channel_ids: they will send channel_announcement /
   channel_update / node_announcement followed by reply_short_channel_ids_done.
2. query_channel_range: they will send one or more reply_channel_range
   with the short_channel_ids in these blocks.
3. gossip_timestamp_filter: filters what gossip they send.

It also changes behavior: we no longer send a `channel_announcement`
until we have at least one `channel_update`.  The announcement is
fairly useless without an update already, but this in particular
enables reasonable timestamp filtering (channel_announcement does not
have an explicit timestamp).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-06-28 00:21:23 +00:00
Rusty Russell
aab92b15b7 BOLT #7: introduce term "gossip messages" to refer to channel_announcement/channel_update/node_announcement.
This makes discussing them simpler for the next patch.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-06-28 00:21:23 +00:00
ueno
f5f123c02c BOLT 0: fix ordering of chain_hash 2018-04-16 13:25:30 -07:00
kurihei
ae7589b45c typo 2018-04-11 03:22:01 +00:00
Rusty Russell
b476e630b0 BOLT 7: don't send an announce_signatures message if we're shutting down.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-03-05 09:04:33 +00:00
Landon Mutch
857c71a3c8 fix requests by @shannona 2018-02-20 01:30:18 +00:00
Landon Mutch
4a2e6229f6 BOLT 07: finish first pass copy edit to bring inline with stylesheet guidelines; 2018-02-20 01:30:18 +00:00
Landon Mutch
abb4b3ac3e BOLT 07: first pass copy edit to line 574; 2018-02-20 01:30:18 +00:00
Landon Mutch
124b1f8d84 BOLT 07: first pass copy edit to line 456
Impose 'origin/final node' terminology (replacing 'creating/receiving node') for sake of clarity and consistency with other BOLTs;
2018-02-20 01:30:18 +00:00
practicalswift
316882fcc5 Use a vs an consistently 2018-02-20 01:12:29 +00:00
Conner Fromknecht
1e06c00f49 BOLT 07: notes node alias injection vulnerabilities 2018-02-05 23:38:01 +00:00
practicalswift
2c3466a2af Remove trailing whitespace 2018-01-30 04:54:31 +00:00
toadlybroodle
f6e8b0bf37 BOLT 7: make requested changes by @shannona 2018-01-30 03:46:25 +00:00
toadlybroodle
8025e81a2b BOLT 7: fix changes requested by @rustyrussell 2018-01-30 03:46:25 +00:00
toadlybroodle
e3ca76a34a BOLT 7: first pass copy edit to line 315 2018-01-30 03:46:25 +00:00
toadlybroodle
2252449c45 BOLT 07: first pass copy edit to line 210 2018-01-30 03:46:25 +00:00
toadlybroodle
dee91424fa BOLT 7: first pass copy edit to line 120 2018-01-30 03:46:25 +00:00
Rusty Russell
64cf99d854 BOLT 7: channel_update timestamp must be a UNIX timestamp.
As agreed at the previous meeting, we use the timestamp to prune,
so it does have to be a valid timestamp.  We also suggest ignoring
if it's in the far future, too.

The minutes suggest we can prune for any reason, and that's really
true anyway; the requirements to keep it around are only SHOULD.

Note that this only applies to channel_update: node_announces
are not pruned (except, perhaps, by implication when all channels
are pruned)

Closes: #302
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-22 13:59:45 +01:00
Rusty Russell
8618c8a74e BOLT 7: there's no htlc_expiry, it's called cltv_expiry.
Closes: #325
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-20 02:55:01 +00:00
Pierre-Marie Padiou
d622832d8e use remote's htlc_minimum_msat in channel_update
This is a consequence of commit d1fbfd30f8: we now only use *outgoing* `channel_update` messages to build a route.

Basically the node publishing the `channel_update` says: I can only send htlcs > `htlc_minimum_msat` through this channel.

I think this is consistent with the current definition of the `amount_below_minimum` error (BOLT 4):
> If the HTLC does not reach the current minimum amount, we tell them the amount of the incoming HTLC and the current channel setting for the outgoing channel:
2017-12-14 02:14:07 +00:00
Rusty Russell
298489b421
BOLT 7: mention Tor hidden service. (#316)
* BOLT 7: mention Tor hidden service.

This is a common term to search for, rather than onion address (which is
what Tor hidden services use).

Reported-by: Alan Manuel K. Gloria <almkglor@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-14 02:06:28 +00:00
Shannon Appelcline
27cc354c63 My final edits on these BOLT-7 changes 2017-12-10 23:42:21 +00:00
Shannon Appelcline
8fd6e4f66b Edits for BOLT-07 2017-12-10 23:42:21 +00:00
Rusty Russell
58d4d9bca3 BOLT 2: Details of HTLC Timeouts, ie. cltv_expiry_delta.
Complete rewrite, including a routing example and the new
min_final_cltv expirt.  I hope this makes it clear.

(Thanks to everyone who reviewed and gave feedback; you rock!)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-10-19 12:44:53 -07:00
Pierre-Marie Padiou
d1fbfd30f8 BOLT 7,11: Added an optional min_final_cltv_expiry field in BOLT 11 (#258)
Added an optional `c` field in the payment request specifying the
minimum `cltv_expiry` to use for the last htlc in the route. If
not provided, default value is 9.

This commit also clarifies how `channel_update` messages are only
to be used in the context of relaying payments, and how both htlc
amounts and expiries are to be calculated backwards from the values
provided in the payment request.

Not needing the `channel_update` for the first channel in a route also
means that it is possible to make a payment through a channel which 
hasn't had any announcements yet.
2017-10-18 15:31:31 +02:00
Jim Posen
9073a5f3de multi: Fix a few typos and grammatical errors. 2017-09-25 12:34:30 +09:30
Olaoluwa Osuntokun
25fc33bfbb glossary: move definition of chain_hash to BOLT #0
This commit modifies the glossary to add a new entry which defines the
usage of `chain_hash` throughout the remainder of the documents.
Additionally, we now also specify which chain hash we expect for
Bitcoin within the glossary.

This commit also modifies BOLT #2 and #7 to omit the definition of the
expected `chain_hash` value for Bitcoin.
2017-08-08 10:06:21 +09:30
Olaoluwa Osuntokun
956e8809d9 BOLT 7: add chain_hashes values to channel_update and channel_announcment
This commit adds a 32-byte `chain_hash` value to both the
`channel_update` and `channel_announcement` messages. The rationale for
this change is that this value is already present within the
`open_channel` for identifying _which_ chain to open the channel
within. As is now, if a pair of peers had channels open on two chains
which somehow are encoded using the same `short_channel_id`, then the
announcements would be ambitious. We resolve this by explicitly
including the `chain_hash` is all channel related announcement
messages.

Note that with this change, we now require 40-bytes to uniquely
identify a channel globally.

Additionally, this modification of the channel announcement messages
allows peers to start building up a heterogenous network graph.
2017-08-08 10:06:21 +09:30
kek-coin
3274087bd4 Reword proportional fee explanation. 2017-08-07 22:03:58 +09:30
Christian Decker
170cb318a1 BOLT7: Add shadow route extension in the recommendations
This is a recommendation to fuzz the CLTV on the HTLCs such that nodes
along the route have a harder time identifying the intended
recipient. We can either add a random offset or we can start a random
walk from the intended recipient and create a shadow route extension.

Closes #185
2017-07-30 15:15:24 +02:00
Christian Decker
a257554456 BOLT7: Reorder feature bitmaps in order to allow future changes
Appending new fields to the end of the messages allows us to add new
fields to an existing message, however it does not allow removing
existing fields, e.g., dropping the pubkeys like #187 proposes. Moving
the features bitmap at the beginning of the signed payload allows
this type of change in the future. Nodes verify the integrity of the
message and then check whether there are any even bits they don't
implement. These even bits being required features would then result
in the message being discarded.

In addition to what we discussed during the call I also went ahead and
did the same reordering on `node_announcement`, which I think has the
same issue.

There is a subtle change in semantics, i.e., previously we would
add channels with unknown bits to our local view, but then ignore them
when computing a route. Now we no longer add them to our view, and may
discard the announcement altogether, stopping the broadcast. This is
safe I think since otherwise we'd be forwarding things we can only
verify the signatures of, but nothing else.
2017-07-11 11:09:03 +02:00
Christian Decker
a537af3d62 BOLT7: Refer to announce_channel bit, not channels_public
This was changed a while ago, but not reflected here.
2017-07-11 10:39:54 +09:30
Christian Decker
f2d03e707b BOLT7: Allow channel_updates for non-public channels
This was pointed out by @btcontract in #188: we need to communicate
our forwarding parameters even for private channels since otherwise
the other endpoint cannot use the private channel for incoming
routes. So we also accept `channel_update`s for our own channels even
for channels that were not announced publicly. Adds a bit of special
handling for our own channels in the gossip, but it is needed since
private channels would be completely unusable otherwise.
2017-07-11 10:39:54 +09:30
Christian Decker
a5437d065b BOLT7: Add network view pruning (#191)
Explicitly mentions that nodes SHOULD monitor the chain for channel
closes, and that a node MAY be removed if no open channels for that
node remain open.

Also mentions the 2 week lazy pruning we discussed on the call.

Closes #186
2017-07-11 10:13:09 +09:30
Rusty Russell
46848dcf21 BOLT 7: fix outdated description of channel announce.
The requirements were updated in 667ca1fdd6
but not the discussion above.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-06-28 11:36:04 +09:30
Olaoluwa Osuntokun
667ca1fdd6 BOLT 2: allow peers to conditionally signal channel announcement in open_channel
This commit gives peers the ability to signal their intent to make a
channel private in the `open_channel` message. This differs from the
current method as now peers are able to create multiple channels with
heterogeneous announcement policies _without_ disconnecting and
re-connecting in-between each channel funding. The prior requirement
for the nodes to re-connect was burdensome and unnecessary.

[ Minor tweaks from feedback folded in -- RR ]
2017-05-27 10:30:42 +09:30
Rusty Russell
068b0bccf9 BOLT 2,4,7: use 8 bytes for amounts, restrict add_htlc for bitcoin only. (#175)
We had 4 byte fields for amounts because people have no ability to assess
risk, and this limited the damage to $70 at a time.

But then that means $1 maximum HTLCs on Litecoin, which isn't enough
for a cup of (decent) coffee.

Rather than have boutique hacks for Litecoin we enlarge the fields now,
and simply have a bitcoin-specific restriction that the upper 4 bytes be 0.

The ctlv_expiry field is moved down in update_add_htlc, to preserve alignment.

Suggested-by: Olaoluwa Osuntokun <laolu32@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-05-23 12:36:34 +09:30
Rusty Russell
8b600e28ff FIXUP: length fixes from pm47 2017-05-18 09:56:05 +09:30
Olaoluwa Osuntokun
60f611d7b7 BOLT 7: add current and next-generation tor onion addresses
This commit extends the set of define address descriptor types to
include support for v2 (current-gen) and v3 (next-gen) onion service
addresses. This enables user to run their Lightning nodes as onion
services, only accepting in-bound connections via their onion
addresses. Running a Lightning node behind Tor may serve to boost the
privacy of a user as they no longer need to give away their location
when advertising their node as willing to accept in-bound connections.

The current generation onion service address are widely deployed and
similar looking. They consume 10-bytes of space as they are the SHA-1
hash of a 1024-bit RSA public key. Encoding using base-32, they look
like: v2cbb2l4lsnpio4q.onion.

The next-generation onion services addresses are defined within
prop224[1]. These addresses are a bit longer as they includes a full
e25519 public key (32-bytes), a 2-byte checksum, and finally a 1 byte
version. The full length of the raw version of these addresses are
35-bytes. When encoded using base-32, then next-gem onion address look
like: btojiu7nu5y5iwut64eufevogqdw4wmqzugnoluw232r4t3ecsfv37ad.onoin.

[1]:
https://gitweb.torproject.org/torspec.git/tree/proposals/224-rend-spec-n
g.txt
2017-05-18 09:56:05 +09:30
Olaoluwa Osuntokun
91f0deb1c1 BOLT 7: use bullet points, not numbers to enumerate address descriptor types 2017-05-18 09:56:05 +09:30