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

46 Commits

Author SHA1 Message Date
niftynei
c00c0dd7bc interactive-tx: Add dual-funding flow, using the interactive tx protocol
This commit adds the interactive transaction construction protcol, as
well as the first practical example of using it, v2 of channel
establishment.

Note that for v2 we also update the channel_id, which now uses the hash
of the revocation_basepoints. We move away from using the funding
transaction id, as the introduction of RBF* makes it such that a single
channel may have many funding transaction id's over the course of
its lifetime.

*Later, also splicing
2024-02-13 11:55:23 -06:00
Olaoluwa Osuntokun
8cb9b890cc
Merge pull request #1095 from vincenzopalazzo/macros/specify-multiple-fields
bol09: Specify behavior when a node specifies both optional and required features
2023-08-14 13:18:07 -07:00
Vincenzo Palazzo
ec59f7c1ca
bol09: Specify behavior when a node specifies both optional and required features
While reviewing a patch on lnprototest, I encountered a scenario
where the BOLT 9 specification needed to provide clear guidance.

As a result, this commit adds specific requirements to
determine the appropriate behaviour when a node specifies
both optional and required features.

Additionally, if this situation appears to be an
implementation bug, it will be taken care of accordingly.

Reported-by: lnprototest
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-08-14 22:04:10 +02:00
Rusty Russell
17ceba42dc BOLT 4: onion message support.
These use onion encoding for simple one-way messaging: there are no error returns.
However, every onion uses route blinding *even if it doesn't need to*.

You can prove what path was used to reach you by including `path_id` in the
encrypted_data_tlv.

Note that this doesn't actually define the payload we're transporting:
that's explictly defined to be payloads in the 64-255 range.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-08-01 06:20:16 +09:30
t-bast
c4c5a8e5fb Bolt 4: add blinded payments
Add specification requirements for using route blinding to make payments
while preserving recipient anonymity. Implementers must ensure they
understand all those requirements, there are subtle attacks that could let
malicious senders deanonymize the route if incompletely implemented.
2023-03-28 08:44:14 +02:00
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
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
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
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
Joost Jager
2ab3a9f022
Add payment metadata to payment request 2022-01-03 20:09:14 +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
Johan T. Halseth
fdc078f845
feature: define option_zero_htlc_tx_fee (feature 22/23) (#824)
This PR adds a new feature bit to define the new and improved anchor outputs commitment format.
2021-08-30 13:50:25 -07:00
Rusty Russell
3508e4e85d BOLT 2: option_shutdown_anysegwit
In bitcoin 0.19.0, standardness rules are going to be relaxed to allow
future witness versions.  Once this is widely deployed, it will be safe
to accept them, smoothing use of future segwit versions.

See: https://github.com/bitcoin/bitcoin/pull/15846

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-05-25 06:46:27 +09:30
Johan T. Halseth
a00418f5f9
bolt-09: reserve feature bits for option_anchors_zero_fee_htlc_tx (#828) 2021-01-04 20:40:57 +01:00
Joost Jager
1739746afa
Anchor outputs
This commit extends the specification with a new commitment format that
adds two anchor outputs to the commitment transaction. Anchor outputs
are a safety feature that allows a channel party to unilaterally increase
the fee of the commitment transaction using CPFP and ensure timely
confirmation on the chain. There is no cooperation required from the
remote party.
2020-08-19 15:27:21 +02:00
Rusty Russell
3a8911dc7a BOLT 9: don't advertize option_support_large_channel in channel_announcement.
Turns out Eclair doesn't, and as c-lightning 0.8.2 implemented and Matt
noticed in https://github.com/lightningnetwork/lightning-rfc/pull/770, it
should have been ODD anyway!

See also: https://github.com/ElementsProject/lightning/issues/3703

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-05-11 22:20:29 +02:00
araspitzu
38479359a1
Single-option large channel proposal (#596)
Add option to open large channels (wumbo).
2020-02-18 09:21:22 +01:00
Conner Fromknecht
4c638b7353 09+11: require transitive feature dependencies
This commit:
 - Adds a new Dependencies column to the BOLT 9 feature table
   populated with existing feature dependencies.
 - Requires that all valid feature vectors set transitive dependencies.
 - Requires checking transitive dependencies when validating init
   messages and payment request.
 - Removes transitive feature requiremetns from the BOLT 11 writer, now
   that they are implicit by needing to comply with the BOLT 9 origin
   requirements.
2020-01-21 13:26:49 +01:00
Conner Fromknecht
b62c8782ed BOLT09: fix incorrect hyperlink text for option_mpp (#725) 2020-01-10 11:45:13 +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
Matt Corallo
44c5fa1c7a Resolve conflict between BOLT 4&9 re: var_onion_optin context
BOLT 4 explicitly indicates var_onion_optin may appear in a BOLT 11
invoice, however, BOLT 9 only indicates it is available in init and
node_announcement contextx. Resolve this conflict in favor of BOLT 4
as there doesn't seem to be much reason to *not* allow it in BOLT
11 invoices.
2019-12-24 13:29:37 -05:00
Rusty Russell
b2a3c2fb07 BOLT 9: Add feature bits for payment_secret and basic_mpp.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-12-13 03:48:57 +00:00
Rusty Russell
8e69306e0a BOLT 11: use the same features for BOLT11 invoices as for others.
A bit less dense, but avoids a separate feature space.

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
Rusty Russell
2afe3559e8 option_static_remotekey: final draft.
This separates out the static remotekey changes from the more ambitious
option_simplified_commitment (which also included pushme outputs and
bring-your-own-fee for HTLC outputs).

As per http://www.erisian.com.au/meetbot/lightning-dev/2019/lightning-dev.2019-09-02-20.06.html

Thanks to everyone for feedback: @araspitzu @roasbeef @bitconner

Suggested-by: @roasbeef
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-09-26 06:19:58 +00:00
sstone
30485af1df Define a feature bit for extended gossip queries 2019-09-16 22:36:59 +02:00
Bastien Teinturier
8b2cf00546
Bolt 04: fix a few left-over spelling / clean-up nits (#653)
* Fix a few left-over spelling / clean-up nits
* Bolt 09: fix spec links
2019-07-31 07:21:38 +00:00
Christian Decker
15299bd57a bolt09: Cleanup the feature bits tables and extract URLs into footer
The tables were a bit unreadable in the source view, and the globalfeatures
table was not rendering correctly. This is just a minor cleanup pass.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
Suggested-by: Janus Troelsen <@ysangkok>
2019-07-26 11:38:33 +02:00
Christian Decker
6120510dd3 bolt07: Add feature bits for multi-frame support 2019-07-26 11:38:33 +02:00
Jorge Timón
38bd57be76
BOLT9: Format table 2019-05-25 01:46:35 +02: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
Landon Mutch
310d9c3b10 BOLT09 copy edit for clarity and consistency with stylesheet guidelines 2018-06-26 20:44:20 +00:00
pm47
2cb41db4a2 consistency: option-data-loss-protect->option_data_loss_protect 2018-03-05 19:20:37 +00:00
practicalswift
2c3466a2af Remove trailing whitespace 2018-01-30 04:54:31 +00:00
Shannon Appelcline
c7c8691d30 BOLT-09 Edits (#321)
I regularized the descriptions in the localfeatures table, so keep a careful eye on the accuracy of those. Otherwise, fairly standard editing in this very short section.

Added text for lack of globalfeatures flags.
2017-12-14 02:08:43 +00:00
Rusty Russell
0c92bda566 BOLT 9: Adding missing option bits for option-dataloss-protect.
Somehow this got lost in merging; pre-approved at meeting 2017-11-27.

Reported-by: Pierre-Marie Padiou
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-11-28 23:03:12 +00:00
Rusty Russell
963b103113 BOLT 2: add precommitment to scriptpubkey for mutual close.
This is Fabrice's #243 "BOLT2, BOLT3: reduce attack surface", split
out with minor polishing:

- Made it an optional feature (we can insist on it if we choose even bit).
- Rename from "final_scriptpubkey" to "shutdown_scriptpubkey".
- Make requirements the same as shutdown's scriptpubkey, or zero-len.
- Leave shutdown's scriptpubkey, just make sure it's the same or fail.
- Add to accept_channel as well as open_channel.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-11-28 00:09:57 +00:00
ueno
6d43b28258 fix some links 2017-10-17 07:25:48 +00:00
Olaoluwa Osuntokun
5e666b6c99 BOLT 9: remove feature bit for channels_public
This commit removes the feature bit for channels_public as they have
been deprecated by the addition of the `announce_channel` field in the
`open_channel` message.
2017-05-27 10:30:42 +09:30
Rusty Russell
1e228bcf8f Clarify init-message description
This is based on a series of patches from @EmelyanenkoK which makes the treatment of feature bits clearer and adds rationale so that future extensions can be made wisely.

Thanks to all involved!

Closes: #156 
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-05-25 09:43:31 +09:30
Rusty Russell
128966e3c0 BOLT 9: Add CC-BY license tag.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-05-11 11:20:36 +09: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