aboutsummaryrefslogtreecommitdiffstats
path: root/eth/downloader/queue.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-05-27 19:26:00 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-05-27 19:26:00 +0800
commit4f1d92b3329572d75a20b9f9e1cccdf74aa7c79f (patch)
treef44e0bf3ac947641f783c5799bf4b70c1151a5e2 /eth/downloader/queue.go
parenta7434fd0085f55235acea5348db0c9247e9aac10 (diff)
downloaddexon-4f1d92b3329572d75a20b9f9e1cccdf74aa7c79f.tar
dexon-4f1d92b3329572d75a20b9f9e1cccdf74aa7c79f.tar.gz
dexon-4f1d92b3329572d75a20b9f9e1cccdf74aa7c79f.tar.bz2
dexon-4f1d92b3329572d75a20b9f9e1cccdf74aa7c79f.tar.lz
dexon-4f1d92b3329572d75a20b9f9e1cccdf74aa7c79f.tar.xz
dexon-4f1d92b3329572d75a20b9f9e1cccdf74aa7c79f.tar.zst
dexon-4f1d92b3329572d75a20b9f9e1cccdf74aa7c79f.zip
eth/downloader, trie: pull head state concurrently with chain
Diffstat (limited to 'eth/downloader/queue.go')
-rw-r--r--eth/downloader/queue.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/eth/downloader/queue.go b/eth/downloader/queue.go
index 195eae4ff..01897af6d 100644
--- a/eth/downloader/queue.go
+++ b/eth/downloader/queue.go
@@ -1262,13 +1262,19 @@ func (q *queue) deliverNodeData(results []trie.SyncResult, callback func(error,
// Prepare configures the result cache to allow accepting and caching inbound
// fetch results.
-func (q *queue) Prepare(offset uint64, mode SyncMode, pivot uint64) {
+func (q *queue) Prepare(offset uint64, mode SyncMode, pivot uint64, head *types.Header) {
q.lock.Lock()
defer q.lock.Unlock()
+ // Prepare the queue for sync results
if q.resultOffset < offset {
q.resultOffset = offset
}
q.fastSyncPivot = pivot
q.mode = mode
+
+ // If long running fast sync, also start up a head stateretrieval immediately
+ if mode == FastSync && pivot > 0 {
+ q.stateScheduler = state.NewStateSync(head.Root, q.stateDatabase)
+ }
}