From 3100268677109ee70578a0b8d81bd00f866b4e7d Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Mon, 7 Sep 2020 20:28:47 -0500 Subject: [PATCH] nit --- pkg/builder.go | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/pkg/builder.go b/pkg/builder.go index 7a7e325..dcdd2e6 100644 --- a/pkg/builder.go +++ b/pkg/builder.go @@ -106,10 +106,7 @@ func (sdb *builder) buildStateTrie(it trie.NodeIterator) ([]StateNode, error) { stateNodes := make([]StateNode, 0) for it.Next(true) { // skip value nodes - if it.Leaf() { - continue - } - if bytes.Equal(nullHashBytes, it.Hash().Bytes()) { + if it.Leaf() || bytes.Equal(nullHashBytes, it.Hash().Bytes()) { continue } node, nodeElements, err := resolveNode(it, sdb.stateCache.TrieDB()) @@ -295,11 +292,7 @@ func (sdb *builder) createdAndUpdatedState(iters iterPair, watchedAddresses []co diffAcountsAtB := make(AccountMap) it, _ := trie.NewDifferenceIterator(iters.older, iters.newer) for it.Next(true) { - // skip value nodes - if it.Leaf() { - continue - } - if bytes.Equal(nullHashBytes, it.Hash().Bytes()) { + if it.Leaf() || bytes.Equal(nullHashBytes, it.Hash().Bytes()) { continue } node, nodeElements, err := resolveNode(it, sdb.stateCache.TrieDB()) @@ -353,11 +346,7 @@ func (sdb *builder) deletedOrUpdatedState(iters iterPair, diffPathsAtB map[strin diffAccountAtA := make(AccountMap) it, _ := trie.NewDifferenceIterator(iters.newer, iters.older) for it.Next(true) { - // skip value nodes - if it.Leaf() { - continue - } - if bytes.Equal(nullHashBytes, it.Hash().Bytes()) { + if it.Leaf() || bytes.Equal(nullHashBytes, it.Hash().Bytes()) { continue } 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) { storageDiffs := make([]StorageNode, 0) for it.Next(true) { - // skip value nodes - if it.Leaf() { - continue - } - if bytes.Equal(nullHashBytes, it.Hash().Bytes()) { + if it.Leaf() || bytes.Equal(nullHashBytes, it.Hash().Bytes()) { continue } 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) it, _ := trie.NewDifferenceIterator(a, b) for it.Next(true) { - // skip value nodes - if it.Leaf() { - continue - } - if bytes.Equal(nullHashBytes, it.Hash().Bytes()) { + if it.Leaf() || bytes.Equal(nullHashBytes, it.Hash().Bytes()) { continue } 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) it, _ := trie.NewDifferenceIterator(b, a) for it.Next(true) { - // skip value nodes - if it.Leaf() { - continue - } - if bytes.Equal(nullHashBytes, it.Hash().Bytes()) { + if it.Leaf() || bytes.Equal(nullHashBytes, it.Hash().Bytes()) { continue } node, nodeElements, err := resolveNode(it, sdb.stateCache.TrieDB())