1
0
Fork 0
mirror of https://github.com/lightning/bolts.git synced 2025-03-10 09:10:07 +01:00

Bolt 1: Clarify the definition of tu fields (#1073)

Truncated integer fields, e.g. tu16 cannot have leading zeros
judging by the implementations of the parsers, which are used
across the different ln implementations.
The `can` imposed that it is not necessary to truncate the fields
to values of information.

Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
This commit is contained in:
Peter Neuroth 2023-05-08 22:57:46 +02:00 committed by GitHub
parent 50b2df24a2
commit 5635a3657e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -224,12 +224,12 @@ Various fundamental types are referred to in the message specifications:
* `u32`: a 4 byte unsigned integer * `u32`: a 4 byte unsigned integer
* `u64`: an 8 byte unsigned integer * `u64`: an 8 byte unsigned integer
Inside TLV records which contain a single value, leading zeros in For the final value in TLV records, truncated integers may be used. Leading zeros in
integers can be omitted: truncated integers MUST be omitted:
* `tu16`: a 0 to 2 byte unsigned integer * `tu16`: a 0 to 2 byte truncated unsigned integer
* `tu32`: a 0 to 4 byte unsigned integer * `tu32`: a 0 to 4 byte truncated unsigned integer
* `tu64`: a 0 to 8 byte unsigned integer * `tu64`: a 0 to 8 byte truncated unsigned integer
When used to encode amounts, the previous fields MUST comply with the upper When used to encode amounts, the previous fields MUST comply with the upper
bound of 21 million BTC: bound of 21 million BTC: