aboutsummaryrefslogtreecommitdiffstats
path: root/light/odr.go
diff options
context:
space:
mode:
authorgary rong <garyrong0905@gmail.com>2018-08-28 15:08:16 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-08-28 15:08:16 +0800
commitb69476b372a26679e5bdb33db3d508f2c955e7ff (patch)
tree47757ef2b65302f19aca96327b7a34ad73f652a5 /light/odr.go
parentc64d72bea207ccaca3f6aded25d8730a4b8696cd (diff)
downloadgo-tangerine-b69476b372a26679e5bdb33db3d508f2c955e7ff.tar
go-tangerine-b69476b372a26679e5bdb33db3d508f2c955e7ff.tar.gz
go-tangerine-b69476b372a26679e5bdb33db3d508f2c955e7ff.tar.bz2
go-tangerine-b69476b372a26679e5bdb33db3d508f2c955e7ff.tar.lz
go-tangerine-b69476b372a26679e5bdb33db3d508f2c955e7ff.tar.xz
go-tangerine-b69476b372a26679e5bdb33db3d508f2c955e7ff.tar.zst
go-tangerine-b69476b372a26679e5bdb33db3d508f2c955e7ff.zip
all: make indexer configurable (#17188)
Diffstat (limited to 'light/odr.go')
-rw-r--r--light/odr.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/light/odr.go b/light/odr.go
index 83c64055a..3cd8b2c04 100644
--- a/light/odr.go
+++ b/light/odr.go
@@ -44,6 +44,7 @@ type OdrBackend interface {
BloomTrieIndexer() *core.ChainIndexer
BloomIndexer() *core.ChainIndexer
Retrieve(ctx context.Context, req OdrRequest) error
+ IndexerConfig() *IndexerConfig
}
// OdrRequest is an interface for retrieval requests
@@ -136,6 +137,7 @@ func (req *ReceiptsRequest) StoreResult(db ethdb.Database) {
// ChtRequest is the ODR request type for state/storage trie entries
type ChtRequest struct {
OdrRequest
+ Config *IndexerConfig
ChtNum, BlockNum uint64
ChtRoot common.Hash
Header *types.Header
@@ -155,6 +157,7 @@ func (req *ChtRequest) StoreResult(db ethdb.Database) {
// BloomRequest is the ODR request type for retrieving bloom filters from a CHT structure
type BloomRequest struct {
OdrRequest
+ Config *IndexerConfig
BloomTrieNum uint64
BitIdx uint
SectionIdxList []uint64
@@ -166,7 +169,7 @@ type BloomRequest struct {
// StoreResult stores the retrieved data in local database
func (req *BloomRequest) StoreResult(db ethdb.Database) {
for i, sectionIdx := range req.SectionIdxList {
- sectionHead := rawdb.ReadCanonicalHash(db, (sectionIdx+1)*BloomTrieFrequency-1)
+ sectionHead := rawdb.ReadCanonicalHash(db, (sectionIdx+1)*req.Config.BloomTrieSize-1)
// if we don't have the canonical hash stored for this section head number, we'll still store it under
// a key with a zero sectionHead. GetBloomBits will look there too if we still don't have the canonical
// hash. In the unlikely case we've retrieved the section head hash since then, we'll just retrieve the