mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 19:30:44 +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.
|
// readStateHistories reads a list of state history records within the specified range.
|
||||||
func readStateHistories(freezer ethdb.AncientReader, start uint64, count uint64) ([]history, error) {
|
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)
|
metaList, aIndexList, sIndexList, aDataList, sDataList, err := rawdb.ReadStateHistoryList(freezer, start, count)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
histories := make([]history, 0, len(metaList))
|
||||||
for i := 0; i < len(metaList); i++ {
|
for i := 0; i < len(metaList); i++ {
|
||||||
var m meta
|
var m meta
|
||||||
if err := m.decode(metaList[i]); err != nil {
|
if err := m.decode(metaList[i]); err != nil {
|
||||||
|
|
|
||||||
|
|
@ -842,7 +842,7 @@ func readTrienodeHistories(reader ethdb.AncientReader, start uint64, count uint6
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var res []history
|
res := make([]history, 0, len(headers))
|
||||||
for i, header := range headers {
|
for i, header := range headers {
|
||||||
var h trienodeHistory
|
var h trienodeHistory
|
||||||
if err := h.decode(header, keySections[i], valueSections[i]); err != nil {
|
if err := h.decode(header, keySections[i], valueSections[i]); err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue