[release/1.4.6] eth/downloader, trie: pull head state concurrently with chain
(cherry picked from commit 4f1d92b332
)
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user