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 /eth/bloombits.go | |
parent | 5463ed99968bf71685a2a8ee9dbf8705912f00cb (diff) | |
download | go-tangerine-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar go-tangerine-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.gz go-tangerine-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.bz2 go-tangerine-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.lz go-tangerine-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.xz go-tangerine-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.tar.zst go-tangerine-6cf0ab38bd0af77d81aad4c104979cebee9e3e63.zip |
core/rawdb: separate raw database access to own package (#16666)
Diffstat (limited to 'eth/bloombits.go')
-rw-r--r-- | eth/bloombits.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/eth/bloombits.go b/eth/bloombits.go index c5597391c..954239d14 100644 --- a/eth/bloombits.go +++ b/eth/bloombits.go @@ -23,6 +23,7 @@ import ( "github.com/ethereum/go-ethereum/common/bitutil" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/bloombits" + "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/params" @@ -60,8 +61,8 @@ func (eth *Ethereum) startBloomHandlers() { task := <-request task.Bitsets = make([][]byte, len(task.Sections)) for i, section := range task.Sections { - head := core.GetCanonicalHash(eth.chainDb, (section+1)*params.BloomBitsBlocks-1) - if compVector, err := core.GetBloomBits(eth.chainDb, task.Bit, section, head); err == nil { + head := rawdb.ReadCanonicalHash(eth.chainDb, (section+1)*params.BloomBitsBlocks-1) + if compVector, err := rawdb.ReadBloomBits(eth.chainDb, task.Bit, section, head); err == nil { if blob, err := bitutil.DecompressBytes(compVector, int(params.BloomBitsBlocks)/8); err == nil { task.Bitsets[i] = blob } else { @@ -107,7 +108,7 @@ func NewBloomIndexer(db ethdb.Database, size uint64) *core.ChainIndexer { db: db, size: size, } - table := ethdb.NewTable(db, string(core.BloomBitsIndexPrefix)) + table := ethdb.NewTable(db, string(rawdb.BloomBitsIndexPrefix)) return core.NewChainIndexer(db, table, backend, size, bloomConfirms, bloomThrottling, "bloombits") } @@ -137,7 +138,7 @@ func (b *BloomIndexer) Commit() error { if err != nil { return err } - core.WriteBloomBits(batch, uint(i), b.section, b.head, bitutil.CompressBytes(bits)) + rawdb.WriteBloomBits(batch, uint(i), b.section, b.head, bitutil.CompressBytes(bits)) } return batch.Write() } |