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

369 Commits

Author SHA1 Message Date
Rusty Russell
4f91f0bb2a htlckey: new basepoint avoid holding the payment secret.
This is stolen from @sstone's #243 "reduce attack surface".

This breaks compatibility, as agreed at the 2017-11-13 meeting.
Note also that it does not update the test vectors.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-11-14 22:58:11 +00:00
Rusty Russell
046f5acb16 BOLT 2: option-data-loss: limited data loss protection.
This is the best I could come up with.  You can't know future
revocation secrets, so if you send onw I know you're ahead of me
somehow.  That means I *MUST NOT* broadcast my latest commitment
transaction, but at least if you're not malicious I'll salvage
something.

We adapt BOLT 5 in a fairly trivial way to specify to say you should
try to handle as much as you can (in fact, you should always be able
to collect their commitment transaction's direct-to-you output).

Fixes: #209
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-11-13 11:10:32 -08:00
Rusty Russell
a759dff029 BOLT 1, tools: add support for our first optional field.
We've always specified that fields can be appended, and we're about to
do our first.  Make it clear that you can't just send one if we add several
fields as part of the same option.

Change extract-formats to have an optional new field appended: the
input format is to simply add ' (optionname)' in the data
specification.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-11-13 11:10:32 -08:00
Rusty Russell
c93cd75d88
BOLT 2,4: allow an error for HTLCs which expire too far away. (#265)
Fixes: #261

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-10-31 00:21:58 +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
Rusty Russell
1066c31c4b aspell: clean up and remove unused words.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-10-17 10:33:12 +00:00
Rusty Russell
ca713c8c6b Remove BOLT #6 from index, spelling list.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-10-17 10:33:12 +00:00
ueno
6d43b28258 fix some links 2017-10-17 07:25:48 +00:00
Salome
bec82b494e Fix f tags in test vectors 2017-10-17 06:45:40 +00:00
Salome
604746b3da Fix signatures and chekcsums in test vectors for payment encodings 2017-10-17 06:45:40 +00:00
Christian Decker
d7791b6d4d BOLT04: Clarify that nodes should continue to unwrap the error onion
This is a partial response to #250. Reordering the HMAC and Encrypt
steps do not give us much, but we might want to hide the route
length. So we suggest that the node should continue unwrapping until
the maximum route length of 20 is reached.
2017-10-17 00:14:08 +02:00
Roman Zeyde
f91df05d19 Remove unused 06-irc-announcements.md file 2017-10-16 21:34:51 +02:00
Pierre-Marie Padiou
2aa9f971af fixed typo htlc->HTLC (#262) 2017-10-12 11:40:05 +02:00
Rusty Russell
b09e119c57 BOLT 11: depending in -> depending on.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-10-11 23:21:12 +00:00
Rusty Russell
fcc8830cc9 Typo fix: CTLV -> CLTV.
Locktime, not timelock.  Found this in my code, too, so pretty sure
it's my fault!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-10-07 14:57:20 +10:30
Rusty Russell
fc9900c101 BOLT 5: require to fail incoming HTLCs if HTLCs time out on chain.
We talked about this below in the Rationale:

    The fulfillment of an on-chain HTLC delivers the `payment_preimage`
    required to fulfill the incoming HTLC...
    Otherwise, it needs to send the `update_fail_htlc` (presumably with
    reason `permanent_channel_failure`) as detailed in [BOLT
    02](https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md#forwarding-htlcs).

But we didn't actually *say* you MUST fail incoming HTLCs after reasonable
depth!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-10-03 11:30:18 +10:30
Pierre-Marie Padiou
465a4cddaf Only cross-signed htlcs can be fulfilled/failed 2017-10-03 11:30:10 +10:30
Jim Posen
9073a5f3de multi: Fix a few typos and grammatical errors. 2017-09-25 12:34:30 +09:30
Jim Posen
31ae0035c0 BOLT 03: Correct txid of funding transaction in test vector.
The txid has the wrong endianness since Bitcoin reverses the byte
order of double-SHA256 hashes.
2017-09-25 12:28:40 +09:30
Jim Posen
fc31c379e2 BOLT 03: Remove extra 0x01 byte from private keys in test vectors.
An 0x01 byte is appended to the end of private keys in the test
vectors to mark them as using compressed serialization to derive the
pubkeys. Two of the private keys have two 0x01 bytes appended,
presumably by accident.
2017-09-25 12:28:40 +09:30
Jim Posen
22dfcbabcc BOLT 03: Fix appendix numbers and TOC links. 2017-09-25 12:28:40 +09:30
Jim Posen
a01f4c55d3 BOLT 03: Fix pseudcode for shachain algorithm.
When deriving a secret from a seed and index, the bits of the index
must be iterated in reverse order.
2017-09-25 12:28:40 +09:30
Rusty Russell
fae35903ae BOLT 5: "MUST spending" -> "MUST spend"
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-09-22 14:41:29 +09:30
Rusty Russell
149cf020d6 BOLT 5: requirement to fail HTLCs which don't have outputs in the commit tx.
BOLT 5 only talks in terms out HTLC outputs, but not all HTLCs have outputs.

HTLCs which are dust for both sides are easy, but others require the
commit tx to be buried before we can consider the HTLC failed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-09-20 10:22:49 +09:30
Rusty Russell
36c099e0d4 BOLT 5: don't fulfill offered HTLCs if peer not committed to it.
Nasty corner case which I got wrong; we can fulfill but then we risk
a reorg removing it.  And anyway, fulfilling reveals that we are
the endpoint in practice.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-09-19 10:44:36 +09:30
Christian Decker
578573f92f Update 04-onion-routing.md
Fixed test vector of full package
2017-09-18 22:47:28 +02:00
Christian Decker
0310e40eda BOLT04: Correct the sphinx packet version in the implementation 2017-09-18 22:47:28 +02:00
Christian Decker
024f695bd1 Shutting the spellchecker up 2017-09-13 13:03:21 +02:00
Christian Decker
813ce3e91f BOLT00: Fix the chain_hash description
This was changed in #237 so fix it here as well.
2017-09-13 13:03:21 +02:00
Fabrice Drouin
700b5e7a5d update test vectors
maximum error payload size is now 128 bytes, see #227
2017-09-13 13:02:46 +02:00
Johan T. Halseth
5a60b03174 Bolt11: specify that bech32 should allow addresses > 90 characters 2017-09-05 14:49:13 +09:30
Conner Fromknecht
e1652819a0 BOLT 5: clarifies penalty txn weight calculation
Attempts to clarify the weight calculation of penalty
  transactions, and makes sweeping the `to_remote` output
  optional without breaking any existing constraints. Assuming
  these figures are correct, the decision to sweep the
  `to_remote` _does not_ change the current unidirectional
  limit of 483 HTLCs.  Thus, the option to do so can be made
  independently by either party/implemenation.

  The previous equation used to calculate `max_num_htlcs`
  slightly underestimated the theoretical maximum weight,
  since non-witness data was treated as 1:1 with witness
  data.  Ultimately, this had no effect on the computed
  results, but figured we should be more specific here for
  the purpose of properly estimating transaction fees.

  This commit also modifies the `to_local_script` to use the
  latest construction; the derived weights have been updated
  accordingly.
2017-09-05 14:47:58 +09:30
Rusty Russell
6204374dff BOLT 11: p is payment hash, not preimage (in annotated examples).
Reported-by: Andy Schroder <info@AndySchroder.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-09-04 21:23:20 +09:30
Janus Troelsen
49edc5417f Fix link to localkey-remotekey-local_delayedkey-and-remote_delayedkey-derivation 2017-08-26 16:42:32 +09:30
Rusty Russell
955e874acc BOLT 11: recommend URI schemes.
This is unofficial, since we don't have IANA tag, but it doesn't
clash with any existing one.  We'll see if this turns out to be something
people want.

Closes: #206
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-22 10:05:09 +09:30
Rusty Russell
4bcf9dde7e BOLT 2: clarify HTLC handling, esp w/ on-chain.
1. We say you can't fail an HTLC until it's removed outgoing; make it clear
   that this could also be on-chain.
2. Insist that you fail an expired HTLC (we never actually said this!)
3. You MUST fulfill an incoming HTLC for which the output was fulfilled
   (otherwise you'll lose money), and of course, even if fulfilled on-chain.

Add an explanation paragraph to BOLT 5 as well, where it discusses on-chain
HTLC output cases (though the requirements about what to do about incoming
HTLCs is actually in BOLT 2).

[ Extra wording clarification thanks to roasbeef ]
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-22 09:59:47 +09:30
Rusty Russell
b3b7a96872 BOLT 5: clarify exactly when to use HTLC transactions.
TL;DR: we only need to do it if it's our commitment tx.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-22 09:59:47 +09:30
Rusty Russell
68d53822bd Spelling: expand wildcard to cover all []() patterns. (#228)
Otherwise it complains about "[BOLT #10](10-dns-bootstrap.md)".

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-22 09:53:34 +09:30
Olaoluwa Osuntokun
876b93151f BOLT 04: increase max size of onion payload messages (#227)
* BOLT 04: increase max size of onion payload messages

This commit increases the max size of the encapsulated onion error
messages. This is a follow up change to the recent change that added a
`chain_hash` field to the `channel_update` message. With the addition of
this field, the largest payload encoded within the onion errors has
expanded to 138 bytes:

  * msat_amount || 2_byte_len || channel_update.

As a result, the old fixed limit (including padding) is now
insufficient. We use 256 bytes here in order to give us room for future
message expansions.
2017-08-22 09:37:02 +09:30
Rusty Russell
eb30bedbb9 Index: add BOLT 10.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-22 09:33:44 +09:30
Rusty Russell
a42b31797e BOLT 11: signature is of single SHA256, not double.
Closes: #223
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-22 09:28:27 +09:30
Christian Decker
017b16ee33 bolt10: shutting the spellchecker up once more 2017-08-21 22:53:18 +02:00
Christian Decker
e2a2021b4b bolt10: Add reference to BTC seed policy 2017-08-21 22:53:18 +02:00
Christian Decker
565ed92581 bolt10: Add condition querying and bech32 encoding 2017-08-21 22:53:18 +02:00
Christian Decker
5c022cca0f bolt10: Typo in sup 2017-08-21 22:53:18 +02:00
Christian Decker
e9ce66b49b bolt10: Added some initial policies 2017-08-21 22:53:18 +02:00
Christian Decker
51115481dd bolt10: Initial draft of the subdomain structure. 2017-08-21 22:53:18 +02:00
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