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

34 Commits

Author SHA1 Message Date
Landon Mutch
cc7811cea8 BOLT 5: copy edit ToC and headers 2017-12-18 19:13:21 +00:00
Landon Mutch
e085f0c036 BOLT 5: justify lines to ~81 character lengths for easier review, remove double spaces, remove double new lines; 2017-12-18 19:13:21 +00:00
Rusty Russell
f1ac62c065 BOLT 5: fix reversed penalty HTLC handling clauses, make it clearer.
HTLC outputs can be resolved by (1) using revocation key,
(2) timeout/preimage use if that's possible, or (3) the cheating party's
HTLC-success/HTLC-timeout tx (which we also specify that you have to
spend using revocation key).

Hopefully this is now clearer.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-11 05:53:32 +00:00
Shannon Appelcline
faba9241ac Manual rebase of Shannon's PR-294 rewrite.
This got a little messy as some changes now needed to be applied in
two places, and other wording has been completely removed.  Another
pass on top will be required.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-08 01:09:42 +00:00
Rusty Russell
433de81d24 BOLT 5: spell out each HTLC case.
The proof-readers rightly noted how confusing the current treatment of
HTLCs is.  There are four different cases, but I tried to address them
in two separate sections, with conditionals.

This expands it out, separating sections for Our Commitment Tx and
Their Commitment Tx, then subsections for our HTLCs and their HTLCs
in each one.

It means some duplicated requirements and rationales, but it should now
be very clear.

As a side effect, we no longer refer to A and B at all: it's all US and THEM.
This needs further clearing up, but for now makes it clear what *we* need to do
for all cases.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-12-08 01:09:42 +00:00
ueno
5989128977 HTLC maximum limit : 511 --> 483
0d7cf77970
2017-11-29 01:57:27 +00:00
Renlord Yang
2e87b35303 Update 05-onchain.md
added permalink to reference implementation code for coinbase maturity check.
2017-11-22 01:21:01 +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
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
Jim Posen
9073a5f3de multi: Fix a few typos and grammatical errors. 2017-09-25 12:34:30 +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
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
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
72b2d4e6c2 BOLT 5: define what "failing a channel" means.
We talk about failing a channel, or channels, but we never spelled
out what a node does in that case.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-05-18 09:48:53 +09:30
Rusty Russell
1b4195c842 BOLT 5: specifically use to_local instead of to-self.
Not all of them: sometimes we refer to to-self including HTLCs which we're
spending ourselves, but in three places we're explicitly referring to
the `to_local` output.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-05-15 12:54:53 -07:00
Rusty Russell
f0da3978e9 Underscores for all terms, not just fields.
Plus a few more missing ones, and some consistency fixes in names
as pointed out by Roasbeed and Fabrice.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-05-15 12:54:53 -07:00
Rusty Russell
67efbd0872 BOLT 5: Add TOC, Authors section, add BOLT URL references.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-05-11 11:20:36 +09:30
Rusty Russell
ab530266e4 BOLT 5: underscores and backticks everywhere.
One minor change to refer to field name:
	preserves `to_self` delay
to:
	preserves `to_self_delay` requirement.

Typo fixes:
1. revocation -> revoke_and_ack
2. ctlv_expiry -> cltv_expiry.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-05-11 11:20:36 +09:30
Rusty Russell
a9c1f06cd4 BOLT 5: typo fixes.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-05-03 13:08:07 +09:30
Rusty Russell
392008a7d3 BOLT 3,5: update weight calculations for revocation key hash in script.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-03-08 05:50:44 +10:30
pm47
557db43378 make htlc outputs of the commitment tx spendable with revocation key
(Merge conflict in test vectors fixed by selecting Pierre's, will have to
 be re-evaluated).

Closes: #105
2017-03-07 09:21:40 +10:30
Rusty Russell
40b747806e BOLT 2, BOLT 5: restrict to ASCII characters.
’ -> '

LANG=C python3 complains otherwise.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-25 10:40:10 +10:30
Christopher Jämthagen
2045d6d632 witnessScript is part of witness + null dummy for OP_CHECKMULTISIG (#70)
* Add null dummy consumed by OP_CHECKMULTISIG
* scriptsig -> witness.
* witness script -> witness.
2017-01-04 16:09:18 +10:30
Rusty Russell
00a8e97a68 BOLT 1: recommend full tx in error pkt if signature fails. (#65)
* BOLT 1: recommend full tx in error pkt if signature fails.

This will usually be the commitment tx, but could also be the HTLC
tx.

Reported-by: pm47 <pm.padiou@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

* FIX: Feedback

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

* BOLT 1: tighten error message `len` requirement.

Of course it has to match data length exactly.

Reported-by: pm47 <pm.padiou@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

* BOLT 1, BOLT 2, BOLT 5: commitsig -> commitment_signed.

Consistency FTW.

Reported-by: pm47 <pm.padiou@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-21 11:37:47 +01:00
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
6e4f7f0cc2 Consistently use 'transaction' instead of 'tx' 2016-12-09 10:41:48 +01:00
Christopher Jämthagen
6750398c97 Some spelling and language fixes in BOLTs 3,4,5 2016-12-07 10:04:57 +01:00
Rusty Russell
14e199d823 BOLT 1, BOLT 2, BOLT 5: 2-byte lengths everywhere.
Since our cryptopacket limits us to 2 bytes, and since people will
send 1-message-per-crypto-packet and nobody will test the
multiple-messages-in-one-cryptopacket code, let's just restrict to
64k messages.

1. Make cryptopacket length not include the HMAC, so we can actually send
   64k messages.
2. Remove len prefix from packet, make type 2 bytes, note alignment properties.
3. Change message internal lengths/counts from 4 to 2 bytes, since more
   is nonsensical anyway, and this removes a need to check before allocating:
    - init feature bitfield length
    - error message length
    - shutdown scriptpubkey length
    - commit_sig number of HTLC signatures
    - revoke_and_ack number of HTLC-timeout signatures
4. Change max-accepted-htlcs to two bytes, and limit it to 511 to ensure
   that commit_sig will always be under 64k.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-29 10:34:43 +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
9b7a2922b1 BOLT #2, #5: derive maximum HTLC limit based on penalty size.
Calculations are put in 05-onchain.md, and referred to by 02-peer-protocol.

The number is 600, comfortably under the 626 theoretical limit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-15 13:56:45 +10:30
Rusty Russell
76dfd378ff Transfer from google doc.
Minimal markdown and consistency fixes, more to come.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-15 11:53:20 +10:30