godoc & cleanup
This commit is contained in:
parent
6f79445570
commit
4ee6319567
@ -492,7 +492,7 @@ func (db *loggingTrieDb) GetReader(root common.Hash, codec uint64) Reader {
|
||||
return &loggingNodeReader{db, codec}
|
||||
}
|
||||
|
||||
// hashReader is reader of hashDatabase which implements the Reader interface.
|
||||
// loggingNodeReader is a trie node reader that logs the number of get operations.
|
||||
type loggingNodeReader struct {
|
||||
db *loggingTrieDb
|
||||
codec uint64
|
||||
@ -561,28 +561,6 @@ func TestNodeIteratorLargeTrie(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIteratorNodeBlob(t *testing.T) {
|
||||
// var (
|
||||
// db = rawdb.NewMemoryDatabase()
|
||||
// triedb = NewDatabase(db)
|
||||
// trie = NewEmpty(triedb)
|
||||
// )
|
||||
// vals := []struct{ k, v string }{
|
||||
// {"do", "verb"},
|
||||
// {"ether", "wookiedoo"},
|
||||
// {"horse", "stallion"},
|
||||
// {"shaman", "horse"},
|
||||
// {"doge", "coin"},
|
||||
// {"dog", "puppy"},
|
||||
// {"somethingveryoddindeedthis is", "myothernodedata"},
|
||||
// }
|
||||
// all := make(map[string]string)
|
||||
// for _, val := range vals {
|
||||
// all[val.k] = val.v
|
||||
// trie.Update([]byte(val.k), []byte(val.v))
|
||||
// }
|
||||
// _, nodes := trie.Commit(false)
|
||||
// triedb.Update(NewWithNodeSet(nodes))
|
||||
|
||||
edb := rawdb.NewMemoryDatabase()
|
||||
db := geth_trie.NewDatabase(edb)
|
||||
orig := geth_trie.NewEmpty(geth_trie.NewDatabase(rawdb.NewMemoryDatabase()))
|
||||
|
@ -47,6 +47,7 @@ type StateTrie struct {
|
||||
// trie is initially empty. Otherwise, New will panic if db is nil
|
||||
// and returns MissingNodeError if the root node cannot be found.
|
||||
func NewStateTrie(id *ID, db *Database, codec uint64) (*StateTrie, error) {
|
||||
// TODO: codec can be derived based on whether Owner is the zero hash
|
||||
if db == nil {
|
||||
panic("trie.NewStateTrie called without a database")
|
||||
}
|
||||
|
@ -64,6 +64,8 @@ func (t *Trie) Copy() *Trie {
|
||||
// zero hash or the sha3 hash of an empty string, then trie is initially
|
||||
// empty, otherwise, the root node must be present in database or returns
|
||||
// a MissingNodeError if not.
|
||||
// The passed codec specifies whether to read state or storage nodes from the
|
||||
// trie.
|
||||
func New(id *ID, db NodeReader, codec uint64) (*Trie, error) {
|
||||
reader, err := newTrieReader(id.StateRoot, id.Owner, db, codec)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user