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)
downloadgo-tangerine-d3b751e4d94f95f6cc89544852f2d5811e075665.tar
go-tangerine-d3b751e4d94f95f6cc89544852f2d5811e075665.tar.gz
go-tangerine-d3b751e4d94f95f6cc89544852f2d5811e075665.tar.bz2
go-tangerine-d3b751e4d94f95f6cc89544852f2d5811e075665.tar.lz
go-tangerine-d3b751e4d94f95f6cc89544852f2d5811e075665.tar.xz
go-tangerine-d3b751e4d94f95f6cc89544852f2d5811e075665.tar.zst
go-tangerine-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)