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

143 Commits

Author SHA1 Message Date
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
Rusty Russell
260e7776ac BOLT 7: more trivial hyphen to underscore updates.
1. ipv4-addr -> ipv4_addr
2. ipv6-addr -> ipv6_addr
3. fee-base-msat -> fee_base_msat
4. htlc-amount-msat -> amount_msat
5. fee-proportional-millionths -> fee_proportional_millionths

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-05-15 12:54:53 -07:00
Rusty Russell
6340cf0db5 BOLT 7: underscores and backticks everywhere.
Also:
1. feature -> features
2. rgb -> rgb_color
3. node-id -> node_id
4. node_update -> node_announcement

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-05-11 11:20:36 +09:30
ZmnSCPxj
d140405a6f 07-routing-gossip.md: channel_update: Update text about end indication.
The channel end is now indicated via a single bit
     in `flags`, not an entire byte.
2017-05-09 16:27:36 +09:30
ZmnSCPxj
eb928390b9 07-routing-gossip.md: Move some text about ipv6 and port from channel_update to node_announcement.
`channel_update` does not make sense as it does not have fields
    with either addresses or ports.
  Moved it to `node_announcement` on the assumption that the text
    was just inserted in the wrong place, since `node_announcement`
    is described before `channel_update` and does have addresses
    and ports.
2017-05-09 16:27:36 +09:30
Pierre-Marie Padiou
f22119b51a fixed typo in BOLT 7 2017-05-07 12:01:12 +09:30
Rusty Russell
4c11d0b058 BOLT 7: typo fix
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-05-03 13:08:07 +09:30
Christian Decker
1060e18332 bolt07: Add flag to disable channels temporarily. (#143)
This is useful to signal either permanent or temporary channel unavailability.
2017-04-08 07:43:10 +09:30
Rusty Russell
4af8e18411 BOLT 0,1,2,7: use txout not channel-id for demuxing. (#119)
At cost of a few extra bytes between peers, this avoids the whole "oops, we were on a chain fork" problem, and simplifies generation of temporary channel-ids (just pick a random one).

Now we move the announcement_signature exchange to at least 6 confirms, which makes re-xmit tricky; I resolved that by insisting on reconnect that we send if we haven't received, and reply to the first one.

The term "channel shortid" wasn't used anywhere, so I removed it; it's now a gossip-only thing anyway.

One subtle change: pkt_error on unknown channels is now "MUST ignore"; this section was reworked anyway, and we'll want this if the #120 goes through, where one side might have forgotten unformed channels).

Closes: #114
Suggested-by: Olaoluwa Osuntokun <laolu32@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

* FIXUP! Two bytes for funding-output-index.

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

* FIXUP! Channel-id rework, temp ids, 32 bits only.

Re-add the idea of temporary channel ids: far simpler since they're now
big enough we can just fill with noise.

Remove the alignment issues by combining txid and outnum using XOR; we
could reduce to 128 bit if we really wanted to, but we don't.

Error handling is now simple again, but while editing I changed the
behaviour for unknown channels to MUST ignore (this is important for

Change the 8-byte gossip channel id to `short-channel-id`.

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

* FIXUP!  Minor text tweaks from Pierre-Marie and Christian

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-03-02 14:50:13 +10:30
pm47
6e8fe9dd2f BOLT 9: make it clear that 'channel_public' apply to all channels in the same connection 2017-02-21 14:41:27 +10:30
Christian Decker
6dda9560a6 BOLT 7: Added flag for optional initial routing sync dump
Opening a lot of connections results in getting this information a
whole lot of times, so let's add an opt-in flag for the initial dump.
2017-02-09 10:11:03 +01:00
Rusty Russell
fba22970c6 BOLT 9: assign feature bits in pairs, give them names, clarify position.
Christian assumed first bit was 1, I assumed 0.  And we should generally
assign in pairs (so an optional understanding can later become compulsory),
though for the initial draft it's unnecessary.

By giving names we avoid smearing values over the spec, containing them in
BOLT 9.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-08 14:16:50 -08:00
Christian Decker
4e3ad54a90 BOLT 2&7: Cleaner separation of concerns wrt announcement signatures (#97)
* BOLT 2&7: Cleaner separation of concerns wrt announcement signatures

So far we did not have any indication on what to do if a node does not
allow announcing the channel and we had a mix of concerns in the
`funding_locked` message, which would also transfer the signatures
needed for the announcement. This is a proposal about splitting the
signatures into their own message, so that simple omission is an
opt-out of announcements, and it does not mix announcement/gossip
stuff into the peer-protocol.

(It also ended up adding a localfeatures flag to opt-into the channel-announcement, and thus creating BOLT 9)
2017-02-07 11:23:39 +10:30
Christian Decker
860990fa0a bolt07: Simplify signature scheme for channel_announcement
Reorders the `channel-id` and `bitcoin-signature-x` fields so that the
signed part of the message is contiguous. Simplifies the signing logic
not to just simple signatures of a contiguous region of the message,
no need to sign signatures, they all commit to the same payload. This
also removes the chicken and egg problem @pm47 reported in #92.
Furthermore it specifies that the signed payload also includes any
future appended fields.
2017-02-01 11:02:19 +10:30
Christian Decker
8e043797bf trivial: Fixing rationaly heading level 2017-01-31 14:40:59 +01:00
Rusty Russell
0c4a8ae6b8 BOLT 2, BOLT 7: rename expiry to cltv-expiry / cltv-expiry-delta.
I can't remember who suggested this, but it's a good idea!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-06 10:01:09 +10:30
Rusty Russell
6e99d24619 BOLT 7: allow multiple address descriptors. (Take II) (#60)
This lets us have both IPv4 and IPv6 (and Tor etc in future) address,
while still preserving the ability to add other fields to the message
in future.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-20 14:23:11 +10:30
Rusty Russell
8c8664452b BOLT 7: fix 21-byte limit typo, allow alias to use all characters.
Reported-by: Fabrice Drouin <fabrice.drouin@acinq.fr>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-13 10:18:11 +10:30
Rusty Russell
653e12730b BOLT 7: minor clarifications
Suggested-by: Christian Decker <cdecker@blockstream.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-13 10:14:54 +10:30
Rusty Russell
666c13c204 BOLT 7: spell out the proof chain for channel_announcement
Inspired by Andrew Samokhvalov's PR, this makes the relationship
between the signatures in `channel_announcement` explicit.

Closes: #27
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-13 10:14:54 +10:30
Rusty Russell
63bd16bf28 BOLT 7: specify that we don't have to rebroadcast huge packets.
We could spam the network with 64k announcements, and each node has to
rememeber them for rebroadcasting.  There's a tradeoff between
allowing future expansions and this potential DoS, so allow nodes to
choose.

My current implementation thinking is: each extra byte reduces chance
of rebroadcast by a small amount, such that if you're twice the
minimum size your chance of rebroadcast hits 0.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-13 10:14:54 +10:30
Rusty Russell
83d918a4a1 BOLT 7: add explicit feature bits to channel_announce and node_announce.
We're going to want these eventually, so let's add them now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-13 10:14:54 +10:30
Rusty Russell
397a27f1b4 BOLT 7: spell out signature checks for receivers.
The sending side says it needs to bitcoin-style sign double-SHA, but the
receiving side doesn't.  Make it clear.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-13 10:14:54 +10:30
Rusty Russell
f58bda73c0 BOLT 7: remove padding.
Having 2 bytes of padding before a string is pointless.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-13 10:14:54 +10:30
Christopher Jämthagen
d076039df2 Use "Bitcoin" with capital "B" where it is appropriate
pseudo random -> pseudo-random
onchain -> on-chain
2016-12-09 10:50:19 +01:00
Christopher Jämthagen
c5ca57b853 [trivial] Some spelling and language fixes in BOLTs 6,7,8 (#41)
* Some spelling and language fixes in BOLTs 6,7,8
2016-12-09 10:32:23 +10:30
Rusty Russell
2e0b7266d1 Merge pull request #14 from lightningnetwork/extraction-tools
tools/extract-formats.py: produce structure definitions and check alignment
2016-11-28 11:34:09 +10:30
Rusty Russell
bcb03f870f Merge pull request #16 from lightningnetwork/flags-in-routing
BOLT 7: Use a flags word, not padding.
2016-11-24 16:26:45 +10:30
Christian Decker
4dde8e6a26 Merge pull request #18 from lightningnetwork/license
Add CC-BY.
2016-11-23 15:49:46 +01:00
Rusty Russell
4806e273ee BOLT 7: Use a flags word, not padding.
This lets us gain 7 more bits, but also as Christian points out, you need
to remember the padding for re-broadcast since the signature covers it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-23 14:26:31 +10:30
Rusty Russell
b928505386 BOLT 7: Use channel-id as per BOLT 2, instead of open-coding components.
This also makes it obvious they're the same as in BOLT 2.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-23 14:13:02 +10:30
Rusty Russell
b742d2f73d BOLT 1, BOLT 2, BOLT 7: Remove message enums
The MSG_XXX is trivially derived from the name of the message if
people want to do that, so just change it to the actual message name.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-23 11:33:25 +10:30
Rusty Russell
865cf82e65 BOLT 07: Signatures should be at beginning.
This means they cover future fields as well (which may or may not be good!)
but also ensures they're naturally aligned in case anyone cares.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-23 10:44:25 +10:30
Rusty Russell
193bbef972 Add CC-BY.
Closes: #2
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-23 06:22:59 +10:30
Rusty Russell
e96412af52 FIX! Clarifications and typo fixes due to Pierre.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-22 12:24:10 +10:30
Rusty Russell
2e93a4184e BOLT #7: More complex proposal, using three separate message types.
Contents stolen from Christian's draft.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-21 16:18:12 +10:30