core/rawdb: separate raw database access to own package (#16666)
This commit is contained in:
@ -25,6 +25,7 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/eth"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
@ -329,11 +330,11 @@ func (pm *ProtocolManager) blockLoop() {
|
||||
header := ev.Block.Header()
|
||||
hash := header.Hash()
|
||||
number := header.Number.Uint64()
|
||||
td := core.GetTd(pm.chainDb, hash, number)
|
||||
td := rawdb.ReadTd(pm.chainDb, hash, number)
|
||||
if td != nil && td.Cmp(lastBroadcastTd) > 0 {
|
||||
var reorg uint64
|
||||
if lastHead != nil {
|
||||
reorg = lastHead.Number.Uint64() - core.FindCommonAncestor(pm.chainDb, header, lastHead).Number.Uint64()
|
||||
reorg = lastHead.Number.Uint64() - rawdb.FindCommonAncestor(pm.chainDb, header, lastHead).Number.Uint64()
|
||||
}
|
||||
lastHead = header
|
||||
lastBroadcastTd = td
|
||||
|
Reference in New Issue
Block a user