mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 03:10:48 +00:00
triedb/pathdb: use known size for history slice allocation
This commit is contained in:
parent
cb97c48cb6
commit
959c8802c0
2 changed files with 2 additions and 2 deletions
|
|
@ -568,11 +568,11 @@ func readStateHistory(reader ethdb.AncientReader, id uint64) (*stateHistory, err
|
|||
|
||||
// readStateHistories reads a list of state history records within the specified range.
|
||||
func readStateHistories(freezer ethdb.AncientReader, start uint64, count uint64) ([]history, error) {
|
||||
var histories []history
|
||||
metaList, aIndexList, sIndexList, aDataList, sDataList, err := rawdb.ReadStateHistoryList(freezer, start, count)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
histories := make([]history, 0, len(metaList))
|
||||
for i := 0; i < len(metaList); i++ {
|
||||
var m meta
|
||||
if err := m.decode(metaList[i]); err != nil {
|
||||
|
|
|
|||
|
|
@ -842,7 +842,7 @@ func readTrienodeHistories(reader ethdb.AncientReader, start uint64, count uint6
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var res []history
|
||||
res := make([]history, 0, len(headers))
|
||||
for i, header := range headers {
|
||||
var h trienodeHistory
|
||||
if err := h.decode(header, keySections[i], valueSections[i]); err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue