Versions in this module Expand all Collapse all v1 v1.10.28 Jan 9, 2023 Changes in this version + const HashScheme + var ErrAlreadyProcessed = errors.New("already processed") + var ErrCommitDisabled = errors.New("no database for committing") + var ErrNotRequested = errors.New("not requested") + func ResolvePath(path []byte) (common.Hash, []byte) + 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 CodeSyncResult struct + Data []byte + Hash common.Hash + type Config struct + Cache int + Journal string + Preimages bool + type Database struct + func NewDatabase(diskdb ethdb.Database) *Database + func NewDatabaseWithConfig(diskdb ethdb.Database, 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) CommitPreimages() error + func (db *Database) Dereference(root common.Hash) + func (db *Database) GetReader(root common.Hash) Reader + 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) Scheme() NodeScheme + func (db *Database) Size() (common.StorageSize, common.StorageSize) + func (db *Database) Update(nodes *MergedNodeSet) error + type ID struct + Owner common.Hash + Root common.Hash + StateRoot common.Hash + func StateTrieID(root common.Hash) *ID + func StorageTrieID(stateRoot common.Hash, owner common.Hash, root common.Hash) *ID + func TrieID(root common.Hash) *ID + 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(keys [][]byte, path []byte, leaf []byte, parent common.Hash, parentPath []byte) error + type MergedNodeSet struct + func NewMergedNodeSet() *MergedNodeSet + func NewWithNodeSet(set *NodeSet) *MergedNodeSet + func (set *MergedNodeSet) Merge(other *NodeSet) error + type MissingNodeError struct + NodeHash common.Hash + Owner common.Hash + Path []byte + func (err *MissingNodeError) Error() string + func (err *MissingNodeError) Unwrap() error + 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 + NodeBlob func() []byte + Parent func() common.Hash + Path func() []byte + func NewDifferenceIterator(a, b NodeIterator) (NodeIterator, *int) + func NewUnionIterator(iters []NodeIterator) (NodeIterator, *int) + type NodeReader interface + GetReader func(root common.Hash) Reader + type NodeScheme interface + DeleteTrieNode func(db ethdb.KeyValueWriter, owner common.Hash, path []byte, hash common.Hash) + HasTrieNode func(db ethdb.KeyValueReader, owner common.Hash, path []byte, hash common.Hash) bool + IsTrieNode func(key []byte) (bool, []byte) + Name func() string + ReadTrieNode func(db ethdb.KeyValueReader, owner common.Hash, path []byte, hash common.Hash) []byte + WriteTrieNode func(db ethdb.KeyValueWriter, owner common.Hash, path []byte, hash common.Hash, ...) + type NodeSet struct + func NewNodeSet(owner common.Hash) *NodeSet + func (set *NodeSet) Hashes() []common.Hash + func (set *NodeSet) Size() (int, int) + func (set *NodeSet) Summary() string + type NodeSyncResult struct + Data []byte + Path string + type NodeWriteFunc = func(owner common.Hash, path []byte, hash common.Hash, blob []byte) + type Reader interface + Node func(owner common.Hash, path []byte, hash common.Hash) (node, error) + NodeBlob func(owner common.Hash, path []byte, hash common.Hash) ([]byte, error) + type SecureTrie = StateTrie + func NewSecure(stateRoot common.Hash, owner common.Hash, root common.Hash, db *Database) (*SecureTrie, error) + type StackTrie struct + func NewFromBinary(data []byte, writeFn NodeWriteFunc) (*StackTrie, error) + func NewStackTrie(writeFn NodeWriteFunc) *StackTrie + func NewStackTrieWithOwner(writeFn NodeWriteFunc, owner common.Hash) *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 StateTrie struct + func NewStateTrie(id *ID, db *Database) (*StateTrie, error) + func (t *StateTrie) Commit(collectLeaf bool) (common.Hash, *NodeSet, error) + func (t *StateTrie) Copy() *StateTrie + func (t *StateTrie) Delete(key []byte) + func (t *StateTrie) Get(key []byte) []byte + func (t *StateTrie) GetKey(shaKey []byte) []byte + func (t *StateTrie) Hash() common.Hash + func (t *StateTrie) NodeIterator(start []byte) NodeIterator + func (t *StateTrie) Prove(key []byte, fromLevel uint, proofDb ethdb.KeyValueWriter) error + func (t *StateTrie) TryDelete(key []byte) error + func (t *StateTrie) TryDeleteAccount(address common.Address) error + func (t *StateTrie) TryGet(key []byte) ([]byte, error) + func (t *StateTrie) TryGetAccount(address common.Address) (*types.StateAccount, error) + func (t *StateTrie) TryGetAccountByHash(addrHash common.Hash) (*types.StateAccount, error) + func (t *StateTrie) TryGetNode(path []byte) ([]byte, int, error) + func (t *StateTrie) TryUpdate(key, value []byte) error + func (t *StateTrie) TryUpdateAccount(address common.Address, acc *types.StateAccount) error + func (t *StateTrie) 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, parentPath []byte) + func (s *Sync) AddSubTrie(root common.Hash, path []byte, parent common.Hash, parentPath []byte, ...) + func (s *Sync) Commit(dbw ethdb.Batch) error + func (s *Sync) MemSize() uint64 + func (s *Sync) Missing(max int) ([]string, []common.Hash, []common.Hash) + func (s *Sync) Pending() int + func (s *Sync) ProcessCode(result CodeSyncResult) error + func (s *Sync) ProcessNode(result NodeSyncResult) error + type SyncPath [][]byte + func NewSyncPath(path []byte) SyncPath + type Trie struct + func New(id *ID, db NodeReader) (*Trie, error) + func NewEmpty(db *Database) *Trie + func (t *Trie) Commit(collectLeaf bool) (common.Hash, *NodeSet, error) + func (t *Trie) Copy() *Trie + 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) 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)