aboutsummaryrefslogtreecommitdiffstats
path: root/trie/sync_test.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-02-16 18:37:00 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-02-16 18:37:00 +0800
commitb8d59d9c985feed9ec1d8851f65517c7e5c09deb (patch)
tree5ceb6da2603a0fceb849e9ecd4aea641c6ebc816 /trie/sync_test.go
parent151c7bef41ed96d9aace3dba235ad2db5fe26e03 (diff)
downloaddexon-b8d59d9c985feed9ec1d8851f65517c7e5c09deb.tar
dexon-b8d59d9c985feed9ec1d8851f65517c7e5c09deb.tar.gz
dexon-b8d59d9c985feed9ec1d8851f65517c7e5c09deb.tar.bz2
dexon-b8d59d9c985feed9ec1d8851f65517c7e5c09deb.tar.lz
dexon-b8d59d9c985feed9ec1d8851f65517c7e5c09deb.tar.xz
dexon-b8d59d9c985feed9ec1d8851f65517c7e5c09deb.tar.zst
dexon-b8d59d9c985feed9ec1d8851f65517c7e5c09deb.zip
core/state, trie: switch iterator panics to error fields
Diffstat (limited to 'trie/sync_test.go')
-rw-r--r--trie/sync_test.go18
1 files changed, 6 insertions, 12 deletions
diff --git a/trie/sync_test.go b/trie/sync_test.go
index ce098d5a0..a81f7650e 100644
--- a/trie/sync_test.go
+++ b/trie/sync_test.go
@@ -18,7 +18,6 @@ package trie
import (
"bytes"
- "fmt"
"testing"
"github.com/ethereum/go-ethereum/common"
@@ -80,25 +79,20 @@ func checkTrieContents(t *testing.T, db Database, root []byte, content map[strin
}
}
-// checkTrieConsistency checks that all nodes in a trie and indeed present.
-func checkTrieConsistency(db Database, root common.Hash) (failure error) {
- // Capture any panics by the iterator
- defer func() {
- if r := recover(); r != nil {
- failure = fmt.Errorf("%v", r)
- }
- }()
+// checkTrieConsistency checks that all nodes in a trie are indeed present.
+func checkTrieConsistency(db Database, root common.Hash) error {
// Remove any potentially cached data from the test trie creation or previous checks
globalCache.Clear()
// Create and iterate a trie rooted in a subnode
trie, err := New(root, db)
if err != nil {
- return
+ return nil // // Consider a non existent state consistent
}
- for it := NewNodeIterator(trie); it.Next(); {
+ it := NewNodeIterator(trie)
+ for it.Next() {
}
- return nil
+ return it.Error
}
// Tests that an empty trie is not scheduled for syncing.