snapshots: use blockReader in IH stage (#3506)

* use blockReader in IH stage

* use blockReader in IH stage
This commit is contained in:
Alex Sharov 2022-02-13 16:03:10 +07:00 committed by GitHub
parent ae652ad5c9
commit bbc4cd4fc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,7 +15,6 @@ import (
"github.com/ledgerwatch/erigon/common"
"github.com/ledgerwatch/erigon/common/changeset"
"github.com/ledgerwatch/erigon/common/dbutils"
"github.com/ledgerwatch/erigon/core/rawdb"
"github.com/ledgerwatch/erigon/core/types/accounts"
"github.com/ledgerwatch/erigon/eth/stagedsync/stages"
"github.com/ledgerwatch/erigon/turbo/trie"
@ -66,12 +65,7 @@ func SpawnIntermediateHashesStage(s *StageState, u Unwinder, tx kv.RwTx, cfg Tri
var expectedRootHash common.Hash
var headerHash common.Hash
if cfg.checkRoot {
var hash common.Hash
hash, err = rawdb.ReadCanonicalHash(tx, to)
if err != nil {
return trie.EmptyRoot, err
}
syncHeadHeader, err := cfg.blockReader.Header(ctx, tx, hash, to)
syncHeadHeader, err := cfg.blockReader.HeaderByNumber(ctx, tx, to)
if err != nil {
return trie.EmptyRoot, err
}