channeldb: prepare RevocationLog for optional fields

This commit is a pure refactor. It restructures the RevocationLog
serialize and deserialize methods so that optional TLV fields can be
easily added.
This commit is contained in:
Elle Mouton
2023-02-02 08:52:21 +02:00
parent 38dc67e1ef
commit ce8e7ecfa7
3 changed files with 90 additions and 74 deletions

View File

@@ -127,7 +127,7 @@ func TestReadTLVStream(t *testing.T) {
// Read the tlv stream.
buf := bytes.NewBuffer(testValueBytes)
err = readTlvStream(buf, ts)
_, err = readTlvStream(buf, ts)
require.NoError(t, err)
// Check the bytes are read as expected.
@@ -150,7 +150,7 @@ func TestReadTLVStreamErr(t *testing.T) {
// Read the tlv stream.
buf := bytes.NewBuffer(b)
err = readTlvStream(buf, ts)
_, err = readTlvStream(buf, ts)
require.ErrorIs(t, err, io.ErrUnexpectedEOF)
// Check the bytes are not read.