From ba1b3415a11f918132ed609a52c20d03fdeef2d0 Mon Sep 17 00:00:00 2001 From: Rootul Patel Date: Wed, 28 Sep 2022 16:30:03 -0400 Subject: [PATCH] chore: rename txLen to unitLen --- pkg/shares/parse_compact_shares.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pkg/shares/parse_compact_shares.go b/pkg/shares/parse_compact_shares.go index 674758e611..60036fbbd0 100644 --- a/pkg/shares/parse_compact_shares.go +++ b/pkg/shares/parse_compact_shares.go @@ -48,19 +48,22 @@ func (ss *shareStack) resolve() ([][]byte, error) { return ss.data, err } -// peel recursively parses each chunk of data (either a transaction, -// intermediate state root, or evidence) and adds it to the underlying slice of data. +// peel recursively parses each unit of data (either a transaction, intermediate +// state root, or evidence) and adds it to the underlying slice of data. +// delimited should be `true` if this is the start of the next unit of data (in +// other words the data contains a unitLen delimiter prefixed to the unit). +// delimited should be `false` if calling peel on an in-progress unit. func (ss *shareStack) peel(share []byte, delimited bool) (err error) { if delimited { - var txLen uint64 - share, txLen, err = ParseDelimiter(share) + var unitLen uint64 + share, unitLen, err = ParseDelimiter(share) if err != nil { return err } - if txLen == 0 { + if unitLen == 0 { return nil } - ss.dataLen = txLen + ss.dataLen = unitLen } // safeLen describes the point in the share where it can be safely split. If // split beyond this point, it is possible to break apart a length