aboutsummaryrefslogtreecommitdiffstats
path: root/eth/downloader
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2017-01-05 22:58:00 +0800
committerFelix Lange <fjl@twurst.com>2017-01-06 21:15:22 +0800
commitd3b751e4d94f95f6cc89544852f2d5811e075665 (patch)
tree14e3417894593f9922551dcb24c3a9d3383f69a2 /eth/downloader
parent7731061903bb992f7630ab389863951efb360258 (diff)
downloaddexon-d3b751e4d94f95f6cc89544852f2d5811e075665.tar
dexon-d3b751e4d94f95f6cc89544852f2d5811e075665.tar.gz
dexon-d3b751e4d94f95f6cc89544852f2d5811e075665.tar.bz2
dexon-d3b751e4d94f95f6cc89544852f2d5811e075665.tar.lz
dexon-d3b751e4d94f95f6cc89544852f2d5811e075665.tar.xz
dexon-d3b751e4d94f95f6cc89544852f2d5811e075665.tar.zst
dexon-d3b751e4d94f95f6cc89544852f2d5811e075665.zip
trie: remove dependency on ethdb
This removes the core/types -> leveldb dependency.
Diffstat (limited to 'eth/downloader')
-rw-r--r--eth/downloader/queue.go15
1 files changed, 10 insertions, 5 deletions
diff --git a/eth/downloader/queue.go b/eth/downloader/queue.go
index b7ad92099..060eaf970 100644
--- a/eth/downloader/queue.go
+++ b/eth/downloader/queue.go
@@ -1123,15 +1123,20 @@ func (q *queue) deliverNodeData(results []trie.SyncResult, callback func(int, bo
callback(i, progressed, errNoFetchesPending)
return
}
- if prog, _, err := q.stateScheduler.Process([]trie.SyncResult{result}); err != nil {
- // Processing a state result failed, bail out
+
+ batch := q.stateDatabase.NewBatch()
+ prog, _, err := q.stateScheduler.Process([]trie.SyncResult{result}, batch)
+ if err != nil {
+ q.stateSchedLock.Unlock()
+ callback(i, progressed, err)
+ }
+ if err = batch.Write(); err != nil {
q.stateSchedLock.Unlock()
callback(i, progressed, err)
- return
- } else if prog {
- progressed = true
}
+
// Item processing succeeded, release the lock (temporarily)
+ progressed = progressed || prog
q.stateSchedLock.Unlock()
}
callback(len(results), progressed, nil)