mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-20 11:46:44 +00:00
Update history_trienode.go
This commit is contained in:
parent
a179ccf6f0
commit
af14bfca24
1 changed files with 4 additions and 4 deletions
|
|
@ -391,15 +391,15 @@ func decodeKeyEntry(keySection []byte, offset int) (uint64, uint64, []byte, int,
|
||||||
|
|
||||||
// decodeRestartTrailer resolves all the offsets recorded at the trailer.
|
// decodeRestartTrailer resolves all the offsets recorded at the trailer.
|
||||||
func decodeRestartTrailer(keySection []byte) ([]uint32, []uint32, int, error) {
|
func decodeRestartTrailer(keySection []byte) ([]uint32, []uint32, int, error) {
|
||||||
var (
|
|
||||||
keyOffsets []uint32
|
|
||||||
valOffsets []uint32
|
|
||||||
)
|
|
||||||
// Decode the number of restart section
|
// Decode the number of restart section
|
||||||
if len(keySection) < 4 {
|
if len(keySection) < 4 {
|
||||||
return nil, nil, 0, fmt.Errorf("key section too short, size: %d", len(keySection))
|
return nil, nil, 0, fmt.Errorf("key section too short, size: %d", len(keySection))
|
||||||
}
|
}
|
||||||
nRestarts := binary.BigEndian.Uint32(keySection[len(keySection)-4:])
|
nRestarts := binary.BigEndian.Uint32(keySection[len(keySection)-4:])
|
||||||
|
var (
|
||||||
|
keyOffsets = make([]uint32, 0, int(nRestarts))
|
||||||
|
valOffsets = make([]uint32, 0, int(nRestarts))
|
||||||
|
)
|
||||||
|
|
||||||
// Decode the trailer
|
// Decode the trailer
|
||||||
if len(keySection) < int(8*nRestarts)+4 {
|
if len(keySection) < int(8*nRestarts)+4 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue