diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-05-07 19:35:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-07 19:35:06 +0800 |
commit | 6cf0ab38bd0af77d81aad4c104979cebee9e3e63 (patch) | |
tree | 142d6f965c44dcf9e2182da67b7bbc978c573448 /core/chain_indexer.go | |
parent | 5463ed99968bf71685a2a8ee9dbf8705912f00cb (diff) | |
download | dexon-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar dexon-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.gz dexon-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.bz2 dexon-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.lz dexon-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.xz dexon-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.zst dexon-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.zip |
core/rawdb: separate raw database access to own package (#16666)
Diffstat (limited to 'core/chain_indexer.go')
-rw-r--r-- | core/chain_indexer.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/chain_indexer.go b/core/chain_indexer.go index 158ed8324..0b927116d 100644 --- a/core/chain_indexer.go +++ b/core/chain_indexer.go @@ -24,6 +24,7 @@ import ( "time" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/event" @@ -206,7 +207,7 @@ func (c *ChainIndexer) eventLoop(currentHeader *types.Header, events chan ChainE // TODO(karalabe): This operation is expensive and might block, causing the event system to // potentially also lock up. We need to do with on a different thread somehow. - if h := FindCommonAncestor(c.chainDb, prevHeader, header); h != nil { + if h := rawdb.FindCommonAncestor(c.chainDb, prevHeader, header); h != nil { c.newHead(h.Number.Uint64(), true) } } @@ -349,11 +350,11 @@ func (c *ChainIndexer) processSection(section uint64, lastHead common.Hash) (com } for number := section * c.sectionSize; number < (section+1)*c.sectionSize; number++ { - hash := GetCanonicalHash(c.chainDb, number) + hash := rawdb.ReadCanonicalHash(c.chainDb, number) if hash == (common.Hash{}) { return common.Hash{}, fmt.Errorf("canonical block #%d unknown", number) } - header := GetHeader(c.chainDb, hash, number) + header := rawdb.ReadHeader(c.chainDb, hash, number) if header == nil { return common.Hash{}, fmt.Errorf("block #%d [%x…] not found", number, hash[:4]) } else if header.ParentHash != lastHead { |