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

986 Commits

Author SHA1 Message Date
Christian Decker
ecaf591bca bolt04: Amend the filler generation and onion decoding to varpayload
This actually introduces the variable size shift and filler generation.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-07-26 11:38:33 +02:00
Christian Decker
a148abbad5 bolt04: Describe the variable size hop_payload
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-07-26 11:38:33 +02:00
Christian Decker
3ac0091ef9 bolt04: Formatting cleanup and fold clarifications into conventions
The clarifications were tacked on after the fact, but they should really be
part of the conventions. I also updated the links to use the reference style,
which results in better text flow and makes it easier to read the source.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-07-26 11:38:33 +02:00
Ugam Kamat
1810eaf4c8 BOLT #7: Correct indentation typo in channel_update message (#649) 2019-07-23 09:27:29 +02:00
ueno
11650d7ebe BOLT7: (announcement_signatures) Fail channel if short_channel_id not correct. (#635) 2019-07-23 09:25:59 +02:00
Rusty Russell
aa33af0c4d BOLT 1: Add test vectors.
These are based on @t-bast's vectors from #607, with a few more
cases:

1. Explicitly test encodings for 253, 254 and 255.
2. Use BigSize and make sure tests break badly if endian parsing is wrong.'
3. Test wrap-around of type encodings in stream.

Many thanks to @t-bast and @cfromknecht for their contributions and testing

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-22 23:27:13 +00:00
Rusty Russell
2fe6af8567 spellcheck: allow space-separated hex, and a few new terms.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-22 23:27:13 +00:00
Rusty Russell
f3fb4ec9c4 BOLT 1: explicitly disallow trailing data, require minimal values.
We didn't explicitly say that the TLV is bad if length exceeds
the message length!

We didn't specify whether to ignore extra bytes: we should.
Similarly, contents of values must be minimal (i.e. tu64 etc).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-22 23:27:13 +00:00
Rusty Russell
6af2ba23a8 tools/extract-formats.py: handle continuous types in tlvs.
We were swallowing the unused line after `data`, but it's
normal to do:

```
1. tlvs: `n1`
2. types:
   1. type: 1 (`tlv1`)
   2. data:
     * [`tu64`:`amount_msat`]
   1. type: 2 (`tlv2`)
   2. data:
     * [`short_channel_id`:`scid`]
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-22 23:27:13 +00:00
Rusty Russell
acad3fc8fe tools/extract-formats.py: recognize numerics in field names.
For some reason (typo?) we only allowed "2", not other numbers!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-22 23:27:13 +00:00
Rusty Russell
950b2f5481 BOLT 2: remove local/remote from reestablish field names.
(No spec change, just wording)

The "local" and "remote" here are just *confusing*.  Each side says
where it's at, and the other side retransmits based on that.

We could call it 'number_of_next_commitment_i_expect_to_receive' and
'number_of_next_revocation_i_expect_to_receive' but that's getting
silly.

These names were a major source of confusion while writing tests!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-22 16:47:19 -05:00
Orfeas Stefanos Thyfronitis Litos
238c06282d Rephrase last node payload requirements (#615)
Mention that `outgoing_cltv_value` has to be equal to
`min_final_cltv_expiry` and `amt_to_forward` has to be equal to
`amount` if the [BOLT #11](11-payment-encoding.md) invoice is used
2019-07-22 22:42:00 +02:00
Conner Fromknecht
65784f755f BOLT01: swap CompactSize for BigSize in TLV format
This commit modifies the varint encoding used for TLV types and lengths
to use a custom format called BigSize. The format is identical to
bitcoin's CompactSize, except it replaces the use of little-endian
encodings for multi-byte values with big-endian. This is done to prevent
mixing endianness within the protocol, since otherwise CompactSize would
be the first introduction of little-endian encodings.
2019-07-22 15:19:09 -05:00
Conner Fromknecht
bc9570d7b4 tools/spellcheck: ignore code blocks 2019-07-22 15:19:09 -05:00
neil saitug
55a9428810
Merge pull request #612 from jtimon/b9-format-table
BOLT9: Format table
2019-07-22 12:58:04 -05:00
Conner Fromknecht
e9ad0fd6a4 BOLT07: correct gossip_timestamp_range to gossip_timstamp_filter (#648) 2019-07-19 09:30:49 +02:00
Jorge Timón
8bdfc16156 BOLT11: Clarification on n field (#613) 2019-07-17 09:45:35 +02:00
Ugam Kamat
1db481ffeb BOLT #7: receiving node requirements related to timestamp for channel_update message (#621)
Clarify timestamp requirements for channel_update messages.
2019-07-16 09:24:26 +02:00
Hugo Doyon
ffeece3dab Bolt 00: Added Internal Links to Glossary (#637) 2019-07-15 10:01:15 +02:00
Hiroki Gondo
ea588805c7 BOLT 7: move the rational of short_channel_id to the definition (#636) 2019-07-11 09:33:42 +02:00
Alex Bosworth
636b9f2e28 Change opcode reference format (#594)
OP_CHECKLOCKTIMEVERIFY and OP_CSV use an inconsistent naming convention.
Update OP_CSV to match the OP_CHECKLOCKTIMEVERIFY convention as OP_CHECKSEQUENCEVERIFY.
2019-07-09 10:40:29 +02:00
Otto Suess
53343c99a5 BOLT 11: fix link (#626)
Update link to reference Bolt04's overpayment ("if the amount paid is more than twice the amount expected [the final node] SHOULD fail the HTLC.")
2019-07-09 09:38:34 +02:00
Rusty Russell
76d4ab9f1a BOLT 1: Remove git conflict marker (#628)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-09 09:37:03 +02:00
Rusty Russell
6f6ea63233 BOLT 1,2,4,7: remove pubkey fundamental type in favor of point.
And remove `secret` and `preimage` types in favor of open-coding.

Agreed-at: http://www.erisian.com.au/meetbot/lightning-dev/2019/lightning-dev.2019-07-08-20.05.html

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-09 00:48:46 +00:00
Rusty Russell
72ed1b2214 BOLT 1: add TLV types.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-09 00:48:46 +00:00
Rusty Russell
6639cef095 Spec: use explicit types, not just bytelengths for fields.
It's trivial to make types->lengths, but not so much the other way.

The types I used here are the ones I found useful in implementation, and
I think add some clarity, though we can certainly argue about them.

There's no normative changes to the spec in here.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-09 00:48:46 +00:00
Rusty Russell
d6e477be43 tools/extract-formats.py: rewrite, change output.
Editing the previous mess was horrific.  I gave up and rewrote using a
generator.

Changes to output:
1. subtypes and tlvs now handled.
2. The output format now has explicit prefixes, so readers don't have
   to rely on number of fields to interpret data.
3. Each field is split into type and count; count is empty if there's
   no '*x'.
4. TLV stream typenames are repeated; TLV record type names are not
   necessarily unique.
5. The unused offset field is removed.
6. No arguments taken: everything is always printed, and you can grep if you
   only want some.

[ Fixup by <niftynei@gmail.com> ]
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-09 00:48:46 +00:00
Bastien Teinturier
a82dd143f1
Merge pull request #607 from cfromknecht/tlv
BOLT01: TLV proposal
2019-07-08 22:53:22 +02:00
Conner Fromknecht
779664cd82
BOLT01: add TLV spec 2019-06-12 15:14:55 -07:00
Jorge Timón
38bd57be76
BOLT9: Format table 2019-05-25 01:46:35 +02:00
Jorge Timón
309e86d471 BOLT2: past fulfillment deadline fails channel 2019-05-21 22:19:13 +02:00
Jorge Timón
42073b6314 f'BOLT5: Unify two practically redundant paragraphs' 2019-05-21 22:18:14 +02:00
Jorge Timón
1958ad866e BOLT5: Unify two practically redundant paragraphs 2019-05-21 22:18:14 +02:00
Orfeas Stefanos Thyfronitis Litos
b9aa458852 BOLT 5: Homogenize Local/Remote Commitment
Make them look similar, choosing the best parts of each
2019-05-13 21:59:36 +02:00
Rene Pickhardt
7cb708da20 BOLT08: define e and s within the context of the noise handshake
When the notation of the noise protocol framework is being introduced the terms `ck` and `k` are being explained but `e` and `s` are only referred to was public keys. I fixed that by stating what they stand for and noting that `s` is usually the the `nodeid` in the context of the Lightning Network protocol.
2019-04-30 20:00:26 -07:00
David A. Harding
d42b4e2ab6 BOLT2: rephrase cltv_expiry_delta text about accepting HTLCs
Saying "the risk is only to the node *accepting* the HTLC" is confusing
because merely accepting an HTLC is risk-free.  The risk comes from
accepting *responsibility to route the payment*, i.e. offering an HTLC
of your own in the next channel on the path, where a too-small
difference in the HTLC values could end up with you cheated out of a
payment.

This revised paragraph hopefully makes that clearer.
2019-04-29 23:20:37 +02:00
sstone
da71867c84 BOLT 4: fix onion vectors
Final result was correct but intermediary results had not been updated when the payloads were changed.
Fixes #494
2019-02-18 20:20:42 +00:00
Simon Vrouwe
090af1a22d BOLT 2: fix sentence in introduction of chapter Channel Establishment 2019-02-18 10:09:32 +00:00
Richard Bondi
8479a92a4f fix broken links 2019-02-18 10:08:04 +00:00
Orfeas Stefanos Thyfronitis Litos
eabfe2d7c5 Rephrase Forwarding HTLCs Requirements
Uses more specific and consistent language ("the"/"that" instead of "an"
where possible). Also helps avoid confusion with unrelated HTLCs that
serve other payments but are shared by the same two nodes.
2019-02-04 23:45:50 +00:00
Orfeas Stefanos Thyfronitis Litos
835ca46a81 BOLT 4: Correct "16-byte" to "12-byte" (padding) 2019-02-04 23:45:38 +00:00
Antoine Riard
6bd1981fc0 Clarify ownership of max_htlc limits at receiving update_add_htlc 2019-02-04 23:44:45 +00:00
Antoine Riard
6508af5145 Specify OP_DATA to express accepted/offered_htlc_script with same
convention
2019-02-04 23:44:25 +00:00
Orfeas Stefanos Thyfronitis Litos
064d6feed0 Align offered and received HTLC scripts similarly 2019-01-22 21:45:06 +01:00
Orfeas Stefanos Thyfronitis Litos
945051e4b0 Clarify behavior of id field in update_add_htlc
Clarify that the id value is not reset after an update is complete
2019-01-22 21:44:44 +01:00
Rusty Russell
a2480ca138 BOLT 4: remove incorrect_payment_amount altogether.
914ebab908 effectively deprecated this, but
left it for "reject if more than 2x expected amount" case.

Leaving it for gross overpayment still leaves an attack on the current
network in practice (all implementations I know of reject grossly excessive
payments), and removing it causes our code to nicely break when regenerating,
since that error code is now not defined anywhere.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-01-22 21:44:22 +01:00
Pierre-Marie Padiou
1f4538cf9b Update 02-peer-protocol.md
Co-Authored-By: rustyrussell <rusty@rustcorp.com.au>
2019-01-22 21:43:58 +01:00
Rusty Russell
a57ff00e93 BOLT #2: order htlc_signatures by BIP69 + increasing CLTV.
We express it has how the outputs are ordered, but the only way you can
detect that is by the htlc_signatures order, which is the part which really
matters.

I finally reproduced this, BTW, which is why I'm digging it up!

Closes: #448
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-01-22 21:43:58 +01:00
Pierre-Marie Padiou
137106a716 report outgoing HTLC values when appropriate
For some relaying errors it makes more sense to report the values of the outgoing HTLC rather than the incoming HTLC.
2019-01-21 21:16:11 +01:00
Hiroki Gondo
f6df488373 BOLT 2: revocation number not revocation hash. 2019-01-15 22:56:42 +00:00