core/rawdb: separate raw database access to own package (#16666)

This commit is contained in:
Péter Szilágyi
2018-05-07 14:35:06 +03:00
committed by GitHub
parent 5463ed9996
commit 6cf0ab38bd
52 changed files with 1288 additions and 1295 deletions

View File

@ -20,7 +20,7 @@ import (
"context"
"time"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/light"
)
@ -56,7 +56,7 @@ func (pm *ProtocolManager) syncer() {
func (pm *ProtocolManager) needToSync(peerHead blockInfo) bool {
head := pm.blockchain.CurrentHeader()
currentTd := core.GetTd(pm.chainDb, head.Hash(), head.Number.Uint64())
currentTd := rawdb.ReadTd(pm.chainDb, head.Hash(), head.Number.Uint64())
return currentTd != nil && peerHead.Td.Cmp(currentTd) > 0
}