Commit Graph

4 Commits

Author SHA1 Message Date
Conner Fromknecht
96e0bb1411
tlv/record: adds various tlv record constructors 2019-08-07 15:03:43 -07:00
Conner Fromknecht
6773d4770a
tlv/primitive: add primitive encodings 2019-08-07 15:03:30 -07:00
Conner Fromknecht
75fcf1cee1
tlv/varint_test: add tests vectors for custom Read/WriteVarInt 2019-08-07 15:03:18 -07:00
Conner Fromknecht
3afcb1f224
tlv/varint: add modified bitcoin varint
This varint has the same serialization as the varint in btcd and
bitcoind, but has different behavior wrt returned errors. In order to
ensure the inner loop properly detects cleanly written records,
ReadVarInt will not only return EOF if it can't read the first byte, as
that means the reader has zero bytes left.

It also modifies the API to allow the caller to provided a static byte
array, which can be reused across all encoding and decoding and
increases performance.
2019-08-07 15:03:05 -07:00