eth/downloader: pass failed index to DeliverNodeData callback

This commit is contained in:
Felix Lange 2017-01-19 13:37:21 +01:00
parent 22a48fe5e8
commit e9313c7099

View file

@ -1093,7 +1093,7 @@ func (q *queue) DeliverNodeData(id string, data [][]byte, callback func(int, boo
// scheduler treats everything as written after Process has returned, but it's // scheduler treats everything as written after Process has returned, but it's
// unlikely to be an issue in practice. // unlikely to be an issue in practice.
batch := q.stateDatabase.NewBatch() batch := q.stateDatabase.NewBatch()
progressed, _, processErr := q.stateScheduler.Process(process, batch) progressed, nproc, procerr := q.stateScheduler.Process(process, batch)
q.stateWriters += 1 q.stateWriters += 1
go func() { go func() {
defer func() { defer func() {
@ -1104,9 +1104,9 @@ func (q *queue) DeliverNodeData(id string, data [][]byte, callback func(int, boo
// waiting for completion of the pivot block's state download. // waiting for completion of the pivot block's state download.
q.active.Signal() q.active.Signal()
}() }()
if processErr != nil { if procerr != nil {
// Return processing errors through the callback so the sync gets canceled. // Return processing errors through the callback so the sync gets canceled.
callback(len(process), progressed, processErr) callback(nproc, progressed, procerr)
return return
} }
err := batch.Write() err := batch.Write()