|
|
@ -65,9 +65,8 @@ type LeafCallback func(leaf []byte, parent common.Hash) error |
|
|
|
//
|
|
|
|
//
|
|
|
|
// Trie is not safe for concurrent use.
|
|
|
|
// Trie is not safe for concurrent use.
|
|
|
|
type Trie struct { |
|
|
|
type Trie struct { |
|
|
|
db *Database |
|
|
|
db *Database |
|
|
|
root node |
|
|
|
root node |
|
|
|
originalRoot common.Hash |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Cache generation values.
|
|
|
|
// Cache generation values.
|
|
|
|
// cachegen increases by one with each commit operation.
|
|
|
|
// cachegen increases by one with each commit operation.
|
|
|
@ -98,8 +97,7 @@ func New(root common.Hash, db *Database) (*Trie, error) { |
|
|
|
panic("trie.New called without a database") |
|
|
|
panic("trie.New called without a database") |
|
|
|
} |
|
|
|
} |
|
|
|
trie := &Trie{ |
|
|
|
trie := &Trie{ |
|
|
|
db: db, |
|
|
|
db: db, |
|
|
|
originalRoot: root, |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if root != (common.Hash{}) && root != emptyRoot { |
|
|
|
if root != (common.Hash{}) && root != emptyRoot { |
|
|
|
rootnode, err := trie.resolveHash(root[:], nil) |
|
|
|
rootnode, err := trie.resolveHash(root[:], nil) |
|
|
|