diff options
author | Felföldi Zsolt <zsfelfoldi@gmail.com> | 2018-08-16 04:25:46 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2018-08-16 04:25:46 +0800 |
commit | 2cdf6ee7e00d6127c372e7a28bb27a80ef495cb2 (patch) | |
tree | 128c3fe2780f604f9eac5d7ff2292994ed2102f6 /les/odr.go | |
parent | e8752f4e9f9be3d2932cd4835a5d72d17ac2338b (diff) | |
download | go-tangerine-2cdf6ee7e00d6127c372e7a28bb27a80ef495cb2.tar go-tangerine-2cdf6ee7e00d6127c372e7a28bb27a80ef495cb2.tar.gz go-tangerine-2cdf6ee7e00d6127c372e7a28bb27a80ef495cb2.tar.bz2 go-tangerine-2cdf6ee7e00d6127c372e7a28bb27a80ef495cb2.tar.lz go-tangerine-2cdf6ee7e00d6127c372e7a28bb27a80ef495cb2.tar.xz go-tangerine-2cdf6ee7e00d6127c372e7a28bb27a80ef495cb2.tar.zst go-tangerine-2cdf6ee7e00d6127c372e7a28bb27a80ef495cb2.zip |
light: CHT and bloom trie indexers working in light mode (#16534)
This PR enables the indexers to work in light client mode by
downloading a part of these tries (the Merkle proofs of the last
values of the last known section) in order to be able to add new
values and recalculate subsequent hashes. It also adds CHT data to
NodeInfo.
Diffstat (limited to 'les/odr.go')
-rw-r--r-- | les/odr.go | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/les/odr.go b/les/odr.go index f8412aaad..2ad28d5d9 100644 --- a/les/odr.go +++ b/les/odr.go @@ -33,14 +33,11 @@ type LesOdr struct { stop chan struct{} } -func NewLesOdr(db ethdb.Database, chtIndexer, bloomTrieIndexer, bloomIndexer *core.ChainIndexer, retriever *retrieveManager) *LesOdr { +func NewLesOdr(db ethdb.Database, retriever *retrieveManager) *LesOdr { return &LesOdr{ - db: db, - chtIndexer: chtIndexer, - bloomTrieIndexer: bloomTrieIndexer, - bloomIndexer: bloomIndexer, - retriever: retriever, - stop: make(chan struct{}), + db: db, + retriever: retriever, + stop: make(chan struct{}), } } @@ -54,6 +51,13 @@ func (odr *LesOdr) Database() ethdb.Database { return odr.db } +// SetIndexers adds the necessary chain indexers to the ODR backend +func (odr *LesOdr) SetIndexers(chtIndexer, bloomTrieIndexer, bloomIndexer *core.ChainIndexer) { + odr.chtIndexer = chtIndexer + odr.bloomTrieIndexer = bloomTrieIndexer + odr.bloomIndexer = bloomIndexer +} + // ChtIndexer returns the CHT chain indexer func (odr *LesOdr) ChtIndexer() *core.ChainIndexer { return odr.chtIndexer |