Versions in this module Expand all Collapse all v0 v0.0.2 Feb 4, 2023 v0.0.1 Feb 4, 2023 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 + NoTries bool + 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 EmptyTrie struct + func NewEmptyTrie() *EmptyTrie + func (t *EmptyTrie) Commit(onleaf LeafCallback) (root common.Hash, committed int, err error) + func (t *EmptyTrie) Copy() *EmptyTrie + func (t *EmptyTrie) Delete(key []byte) + func (t *EmptyTrie) Get(key []byte) []byte + func (t *EmptyTrie) GetKey(shaKey []byte) []byte + func (t *EmptyTrie) Hash() common.Hash + func (t *EmptyTrie) NodeIterator(start []byte) NodeIterator + func (t *EmptyTrie) Prove(key []byte, fromLevel uint, proofDb ethdb.KeyValueWriter) error + func (t *EmptyTrie) ResetCopy() *EmptyTrie + func (t *EmptyTrie) TryDelete(key []byte) error + func (t *EmptyTrie) TryGet(key []byte) ([]byte, error) + func (t *EmptyTrie) TryGetNode(path []byte) ([]byte, int, error) + func (t *EmptyTrie) TryUpdate(key, value []byte) error + func (t *EmptyTrie) TryUpdateAccount(key []byte, account *types.StateAccount) error + func (t *EmptyTrie) Update(key, value []byte) + 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.KeyValueReader) + 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) (common.Hash, int, 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) TryUpdateAccount(key []byte, acc *types.StateAccount) 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() (h common.Hash, err 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 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) (common.Hash, int, 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) TryUpdateAccount(key []byte, acc *types.StateAccount) error + func (t *Trie) Update(key, value []byte)