From d3b751e4d94f95f6cc89544852f2d5811e075665 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 5 Jan 2017 15:58:00 +0100 Subject: trie: remove dependency on ethdb This removes the core/types -> leveldb dependency. --- eth/downloader/queue.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'eth') 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) -- cgit