lnd/tlv
Conner Fromknecht aefec9b10f
tlv: return parsed types from DecodeWithParsedTypes
This commit adds an additional return value to
Stream.DecodeWithParsedTypes, which returns the set of types that were
encountered during decoding. The set will contain all known types that
were decoded, as well as unknown odd types that were ignored.

The rationale for the return value (rather than an internal member) is
so that the stream remains stateless.

This return value can be used by callers during decoding to make
assertions as to whether specific types were included in the stream.
This is need, for example, when parsing onion payloads where certain
fields must be included/omitted depending on the hop type.

The original Decode method would incur the additional performance hit of
needing to track the parsed types, so we can selectively enable this
functionality when a decoder requires it by using a helper which
conditionally tracks the parsed types.
2019-09-05 09:30:37 -07:00
..
bench_test.go tlv/bench_test: add basic benchmark 2019-08-07 15:04:20 -07:00
primitive_test.go tlv/primitive_test: add basic encode/decode tests for primitives 2019-08-08 15:57:48 -07:00
primitive.go tlv/primitive: use constructor for encoding/decoding type err 2019-08-08 15:57:48 -07:00
record_test.go routing/route+tlv: add new TLV-EOB awareness to Hop+Route 2019-08-22 18:53:00 -07:00
record.go tlv: return parsed types from DecodeWithParsedTypes 2019-09-05 09:30:37 -07:00
stream_test.go tlv: return parsed types from DecodeWithParsedTypes 2019-09-05 09:30:37 -07:00
stream.go tlv: return parsed types from DecodeWithParsedTypes 2019-09-05 09:30:37 -07:00
tlv_test.go tlv/stream: create MaxRecordSize, remove lnwire import, add test 2019-08-21 18:12:57 -07:00
truncated_test.go tlv/truncated: fix decoding bug in DTUint16 and DTUint32 2019-08-07 19:42:15 -07:00
truncated.go tlv/truncated: fix decoding bug in DTUint16 and DTUint32 2019-08-07 19:42:15 -07:00
varint_test.go tlv/varint_test: add tests vectors for custom Read/WriteVarInt 2019-08-07 15:03:18 -07:00
varint.go tlv/varint: add modified bitcoin varint 2019-08-07 15:03:05 -07:00