lnd/tlv
yyforyongyu 4ddb5c586b
tlv: add MakeBigSizeRecord to save space
This commit adds a pair of encoder/decoder to take the advantage of the
BigSize format when encoding an uint64 and possibly an uint32.

Often the time an uint64 value is not big enough to fill all the 8
bytes, thus using BigSize can save extra bytes when save it to db. And
for uint32, if we know most of the values do not exceed 65536, we can
also save at least 1 byte using BigSize format.

This commit introduces `MakeBigSizeRecord` that can be used optionally
where db space is a concern.
2022-04-16 12:05:23 +08:00
..
go.mod tlv: update go mod to include require 2022-04-16 12:05:07 +08:00
go.sum tlv: update go mod to include require 2022-04-16 12:05:07 +08:00
primitive_test.go multi: use btcd's btcec/v2 and btcutil modules 2022-03-09 19:02:37 +01:00
primitive.go tlv: add MakeBigSizeRecord to save space 2022-04-16 12:05:23 +08:00
record_test.go tlv: remove unused error return value 2019-12-04 13:27:29 +01:00
record.go tlv: add MakeBigSizeRecord to save space 2022-04-16 12:05:23 +08:00
stream_test.go tlv: add MakeBigSizeRecord to save space 2022-04-16 12:05:23 +08:00
stream.go tlv: expose unknown values 2019-12-10 06:54:20 +01:00
tlv_test.go multi: use btcd's btcec/v2 and btcutil modules 2022-03-09 19:02:37 +01:00
truncated_test.go tlv: simplify byte slice comparison as recommenteded by static analysis 2020-04-24 19:15:08 +02:00
truncated.go tlv: fix comments for numLeadingZeroBytes{32,64} funcs 2020-05-02 00:42:55 +02:00
varint_test.go tlv: simplify byte slice comparison as recommenteded by static analysis 2020-04-24 19:15:08 +02:00
varint.go tlv+record+routing: add payload size calculation 2019-12-20 11:00:01 +01:00