Versions in this module Expand all Collapse all v1 v1.2.0 Jul 8, 2022 Changes in this version + var ErrAlreadyProcessed = errors.New("already processed") + var ErrCommitDisabled = errors.New("no database for committing") + var ErrNotRequested = errors.New("not requested") + func VerifyProof(rootHash common.Hash, key []byte, proofDb ethdb.KeyValueReader) (value []byte, err error) + func VerifyRangeProof(rootHash common.Hash, firstKey []byte, lastKey []byte, keys [][]byte, ...) (bool, error) + type Config struct + Cache int + Journal string + Preimages bool + type Database struct + func NewDatabase(diskdb ethdb.KeyValueStore) *Database + func NewDatabaseWithConfig(diskdb ethdb.KeyValueStore, config *Config) *Database + func (db *Database) Cap(limit common.StorageSize) error + func (db *Database) Commit(node common.Hash, report bool, callback func(common.Hash)) error + func (db *Database) Dereference(root common.Hash) + func (db *Database) DiskDB() ethdb.KeyValueStore + func (db *Database) Node(hash common.Hash) ([]byte, error) + func (db *Database) Nodes() []common.Hash + func (db *Database) Reference(child common.Hash, parent common.Hash) + func (db *Database) SaveCache(dir string) error + func (db *Database) SaveCachePeriodically(dir string, interval time.Duration, stopCh <-chan struct{}) + func (db *Database) Size() (common.StorageSize, common.StorageSize) + type Iterator struct + Err error + Key []byte + Value []byte + func NewIterator(it NodeIterator) *Iterator + func (it *Iterator) Next() bool + func (it *Iterator) Prove() [][]byte + type LeafCallback func(paths [][]byte, hexpath []byte, leaf []byte, parent common.Hash) error + type MissingNodeError struct + NodeHash common.Hash + Path []byte + func (err *MissingNodeError) Error() string + type NodeIterator interface + AddResolver func(ethdb.KeyValueStore) + Error func() error + Hash func() common.Hash + Leaf func() bool + LeafBlob func() []byte + LeafKey func() []byte + LeafProof func() [][]byte + Next func(bool) bool + Parent func() common.Hash + Path func() []byte + func NewDifferenceIterator(a, b NodeIterator) (NodeIterator, *int) + func NewUnionIterator(iters []NodeIterator) (NodeIterator, *int) + type SecureTrie struct + func NewSecure(root common.Hash, db *Database) (*SecureTrie, error) + func (t *SecureTrie) Commit(onleaf LeafCallback) (root common.Hash, err error) + func (t *SecureTrie) Copy() *SecureTrie + func (t *SecureTrie) Delete(key []byte) + func (t *SecureTrie) Get(key []byte) []byte + func (t *SecureTrie) GetKey(shaKey []byte) []byte + func (t *SecureTrie) GetRawTrie() Trie + func (t *SecureTrie) Hash() common.Hash + func (t *SecureTrie) NodeIterator(start []byte) NodeIterator + func (t *SecureTrie) Prove(key []byte, fromLevel uint, proofDb ethdb.KeyValueWriter) error + func (t *SecureTrie) ResetCopy() *SecureTrie + func (t *SecureTrie) TryDelete(key []byte) error + func (t *SecureTrie) TryGet(key []byte) ([]byte, error) + func (t *SecureTrie) TryGetNode(path []byte) ([]byte, int, error) + func (t *SecureTrie) TryUpdate(key, value []byte) error + func (t *SecureTrie) Update(key, value []byte) + type StackTrie struct + func NewFromBinary(data []byte, db ethdb.KeyValueWriter) (*StackTrie, error) + func NewStackTrie(db ethdb.KeyValueWriter) *StackTrie + func (st *StackTrie) Commit() (common.Hash, error) + func (st *StackTrie) Hash() (h common.Hash) + func (st *StackTrie) MarshalBinary() (data []byte, err error) + func (st *StackTrie) Reset() + func (st *StackTrie) TryUpdate(key, value []byte) error + func (st *StackTrie) UnmarshalBinary(data []byte) error + func (st *StackTrie) Update(key, value []byte) + type Sync struct + func NewSync(root common.Hash, database ethdb.KeyValueReader, callback LeafCallback, ...) *Sync + func (s *Sync) AddCodeEntry(hash common.Hash, path []byte, parent common.Hash) + func (s *Sync) AddSubTrie(root common.Hash, path []byte, parent common.Hash, callback LeafCallback) + func (s *Sync) Commit(dbw ethdb.Batch) error + func (s *Sync) Missing(max int) (nodes []common.Hash, paths []SyncPath, codes []common.Hash) + func (s *Sync) Pending() int + func (s *Sync) Process(result SyncResult) error + type SyncBloom struct + func NewSyncBloom(memory uint64, database ethdb.Iteratee) *SyncBloom + func (b *SyncBloom) Add(hash []byte) + func (b *SyncBloom) Close() error + func (b *SyncBloom) Contains(hash []byte) bool + type SyncPath [][]byte + type SyncResult struct + Data []byte + Hash common.Hash + type Trie struct + func New(root common.Hash, db *Database) (*Trie, error) + func (t *Trie) Commit(onleaf LeafCallback) (root common.Hash, err error) + func (t *Trie) Delete(key []byte) + func (t *Trie) Get(key []byte) []byte + func (t *Trie) Hash() common.Hash + func (t *Trie) NodeIterator(start []byte) NodeIterator + func (t *Trie) Prove(key []byte, fromLevel uint, proofDb ethdb.KeyValueWriter) error + func (t *Trie) Reset() + func (t *Trie) Size() int + func (t *Trie) TryDelete(key []byte) error + func (t *Trie) TryGet(key []byte) ([]byte, error) + func (t *Trie) TryGetNode(path []byte) ([]byte, int, error) + func (t *Trie) TryUpdate(key, value []byte) error + func (t *Trie) Update(key, value []byte)