triedb/pathdb: use known size for history slice allocation

This commit is contained in:
bigbear 2026-01-30 19:06:09 +01:00
parent cb97c48cb6
commit 959c8802c0
2 changed files with 2 additions and 2 deletions

View file

@ -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 {

View file

@ -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 {