aboutsummaryrefslogtreecommitdiffstats
path: root/trie
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-05-31 16:52:16 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-05-31 16:52:16 +0800
commit1d5d21726a49a1dcf06d0d1544e1bd93f4231632 (patch)
treed9ddf6637f39ab3593a8664f15723c1afdbb8549 /trie
parent7b662103a026ee96667c8cad96dc952b7896a8af (diff)
parent4f1d92b3329572d75a20b9f9e1cccdf74aa7c79f (diff)
downloaddexon-1d5d21726a49a1dcf06d0d1544e1bd93f4231632.tar
dexon-1d5d21726a49a1dcf06d0d1544e1bd93f4231632.tar.gz
dexon-1d5d21726a49a1dcf06d0d1544e1bd93f4231632.tar.bz2
dexon-1d5d21726a49a1dcf06d0d1544e1bd93f4231632.tar.lz
dexon-1d5d21726a49a1dcf06d0d1544e1bd93f4231632.tar.xz
dexon-1d5d21726a49a1dcf06d0d1544e1bd93f4231632.tar.zst
dexon-1d5d21726a49a1dcf06d0d1544e1bd93f4231632.zip
Merge pull request #2627 from karalabe/concurrent-head-sync
eth/downloader, trie: pull head state concurrently with chain
Diffstat (limited to 'trie')
-rw-r--r--trie/sync.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/trie/sync.go b/trie/sync.go
index a35478f83..6e9e029b9 100644
--- a/trie/sync.go
+++ b/trie/sync.go
@@ -17,6 +17,7 @@
package trie
import (
+ "errors"
"fmt"
"github.com/ethereum/go-ethereum/common"
@@ -24,6 +25,10 @@ import (
"gopkg.in/karalabe/cookiejar.v2/collections/prque"
)
+// ErrNotRequested is returned by the trie sync when it's requested to process a
+// node it did not request.
+var ErrNotRequested = errors.New("not requested")
+
// request represents a scheduled or already in-flight state retrieval request.
type request struct {
hash common.Hash // Hash of the node data content to retrieve
@@ -144,7 +149,7 @@ func (s *TrieSync) Process(results []SyncResult) (int, error) {
// If the item was not requested, bail out
request := s.requests[item.Hash]
if request == nil {
- return i, fmt.Errorf("not requested: %x", item.Hash)
+ return i, ErrNotRequested
}
// If the item is a raw entry request, commit directly
if request.object == nil {