Update history_trienode.go

This commit is contained in:
alex017 2026-01-29 17:22:28 +01:00 committed by GitHub
parent a179ccf6f0
commit af14bfca24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -391,15 +391,15 @@ func decodeKeyEntry(keySection []byte, offset int) (uint64, uint64, []byte, int,
// decodeRestartTrailer resolves all the offsets recorded at the trailer.
func decodeRestartTrailer(keySection []byte) ([]uint32, []uint32, int, error) {
var (
keyOffsets []uint32
valOffsets []uint32
)
// Decode the number of restart section
if len(keySection) < 4 {
return nil, nil, 0, fmt.Errorf("key section too short, size: %d", len(keySection))
}
nRestarts := binary.BigEndian.Uint32(keySection[len(keySection)-4:])
var (
keyOffsets = make([]uint32, 0, int(nRestarts))
valOffsets = make([]uint32, 0, int(nRestarts))
)
// Decode the trailer
if len(keySection) < int(8*nRestarts)+4 {