From 05715f27cfd68387f720db115bb8461f8725a341 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sun, 10 May 2015 00:34:07 +0200 Subject: eth: added a cancel method for the downloader Added a cancel method to the downloader which gracefully shuts down any active syncing process (hash fetching or block downloading) and resets the queue and remove any pending blocks. Issue with the downloader which would stall because of an active ongoing process when an invalid block was found. --- eth/sync.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'eth/sync.go') diff --git a/eth/sync.go b/eth/sync.go index c49f5209d..d955eaa50 100644 --- a/eth/sync.go +++ b/eth/sync.go @@ -63,6 +63,9 @@ func (pm *ProtocolManager) processBlocks() error { max := int(math.Min(float64(len(blocks)), float64(blockProcAmount))) _, err := pm.chainman.InsertChain(blocks[:max]) if err != nil { + // cancel download process + pm.downloader.Cancel() + return err } blocks = blocks[max:] -- cgit