This commit is contained in:
Roy Crihfield 2020-09-07 20:28:47 -05:00
parent 29e3d30a7d
commit 3100268677

View File

@ -106,10 +106,7 @@ func (sdb *builder) buildStateTrie(it trie.NodeIterator) ([]StateNode, error) {
stateNodes := make([]StateNode, 0) stateNodes := make([]StateNode, 0)
for it.Next(true) { for it.Next(true) {
// skip value nodes // skip value nodes
if it.Leaf() { if it.Leaf() || bytes.Equal(nullHashBytes, it.Hash().Bytes()) {
continue
}
if bytes.Equal(nullHashBytes, it.Hash().Bytes()) {
continue continue
} }
node, nodeElements, err := resolveNode(it, sdb.stateCache.TrieDB()) node, nodeElements, err := resolveNode(it, sdb.stateCache.TrieDB())
@ -295,11 +292,7 @@ func (sdb *builder) createdAndUpdatedState(iters iterPair, watchedAddresses []co
diffAcountsAtB := make(AccountMap) diffAcountsAtB := make(AccountMap)
it, _ := trie.NewDifferenceIterator(iters.older, iters.newer) it, _ := trie.NewDifferenceIterator(iters.older, iters.newer)
for it.Next(true) { for it.Next(true) {
// skip value nodes if it.Leaf() || bytes.Equal(nullHashBytes, it.Hash().Bytes()) {
if it.Leaf() {
continue
}
if bytes.Equal(nullHashBytes, it.Hash().Bytes()) {
continue continue
} }
node, nodeElements, err := resolveNode(it, sdb.stateCache.TrieDB()) node, nodeElements, err := resolveNode(it, sdb.stateCache.TrieDB())
@ -353,11 +346,7 @@ func (sdb *builder) deletedOrUpdatedState(iters iterPair, diffPathsAtB map[strin
diffAccountAtA := make(AccountMap) diffAccountAtA := make(AccountMap)
it, _ := trie.NewDifferenceIterator(iters.newer, iters.older) it, _ := trie.NewDifferenceIterator(iters.newer, iters.older)
for it.Next(true) { for it.Next(true) {
// skip value nodes if it.Leaf() || bytes.Equal(nullHashBytes, it.Hash().Bytes()) {
if it.Leaf() {
continue
}
if bytes.Equal(nullHashBytes, it.Hash().Bytes()) {
continue continue
} }
node, nodeElements, err := resolveNode(it, sdb.stateCache.TrieDB()) node, nodeElements, err := resolveNode(it, sdb.stateCache.TrieDB())
@ -477,11 +466,7 @@ func (sdb *builder) buildStorageNodesEventual(sr common.Hash, watchedStorageKeys
func (sdb *builder) buildStorageNodesFromTrie(it trie.NodeIterator, watchedStorageKeys []common.Hash, intermediateNodes bool) ([]StorageNode, error) { func (sdb *builder) buildStorageNodesFromTrie(it trie.NodeIterator, watchedStorageKeys []common.Hash, intermediateNodes bool) ([]StorageNode, error) {
storageDiffs := make([]StorageNode, 0) storageDiffs := make([]StorageNode, 0)
for it.Next(true) { for it.Next(true) {
// skip value nodes if it.Leaf() || bytes.Equal(nullHashBytes, it.Hash().Bytes()) {
if it.Leaf() {
continue
}
if bytes.Equal(nullHashBytes, it.Hash().Bytes()) {
continue continue
} }
node, nodeElements, err := resolveNode(it, sdb.stateCache.TrieDB()) node, nodeElements, err := resolveNode(it, sdb.stateCache.TrieDB())
@ -548,11 +533,7 @@ func (sdb *builder) createdAndUpdatedStorage(a, b trie.NodeIterator, watchedKeys
diffPathsAtB := make(map[string]bool) diffPathsAtB := make(map[string]bool)
it, _ := trie.NewDifferenceIterator(a, b) it, _ := trie.NewDifferenceIterator(a, b)
for it.Next(true) { for it.Next(true) {
// skip value nodes if it.Leaf() || bytes.Equal(nullHashBytes, it.Hash().Bytes()) {
if it.Leaf() {
continue
}
if bytes.Equal(nullHashBytes, it.Hash().Bytes()) {
continue continue
} }
node, nodeElements, err := resolveNode(it, sdb.stateCache.TrieDB()) node, nodeElements, err := resolveNode(it, sdb.stateCache.TrieDB())
@ -593,11 +574,7 @@ func (sdb *builder) deletedOrUpdatedStorage(a, b trie.NodeIterator, diffPathsAtB
deletedStorage := make([]StorageNode, 0) deletedStorage := make([]StorageNode, 0)
it, _ := trie.NewDifferenceIterator(b, a) it, _ := trie.NewDifferenceIterator(b, a)
for it.Next(true) { for it.Next(true) {
// skip value nodes if it.Leaf() || bytes.Equal(nullHashBytes, it.Hash().Bytes()) {
if it.Leaf() {
continue
}
if bytes.Equal(nullHashBytes, it.Hash().Bytes()) {
continue continue
} }
node, nodeElements, err := resolveNode(it, sdb.stateCache.TrieDB()) node, nodeElements, err := resolveNode(it, sdb.stateCache.TrieDB())