aboutsummaryrefslogtreecommitdiffstats
path: root/eth/downloader
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-05-30 02:15:28 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-06-08 18:23:58 +0800
commitabdfcda4dd223f2a2a932628da1e9388d2670856 (patch)
tree3559edeac24314e09c11d6e4769f36b34d74428c /eth/downloader
parent84bc93d8cb3ca2beab96b567507873e53ce80056 (diff)
downloadgo-tangerine-abdfcda4dd223f2a2a932628da1e9388d2670856.tar
go-tangerine-abdfcda4dd223f2a2a932628da1e9388d2670856.tar.gz
go-tangerine-abdfcda4dd223f2a2a932628da1e9388d2670856.tar.bz2
go-tangerine-abdfcda4dd223f2a2a932628da1e9388d2670856.tar.lz
go-tangerine-abdfcda4dd223f2a2a932628da1e9388d2670856.tar.xz
go-tangerine-abdfcda4dd223f2a2a932628da1e9388d2670856.tar.zst
go-tangerine-abdfcda4dd223f2a2a932628da1e9388d2670856.zip
eth/downloader: short circuit sync if head hash is banned
Diffstat (limited to 'eth/downloader')
-rw-r--r--eth/downloader/downloader.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go
index b0d55bc44..af9b6b2b1 100644
--- a/eth/downloader/downloader.go
+++ b/eth/downloader/downloader.go
@@ -165,6 +165,10 @@ func (d *Downloader) Synchronise(id string, hash common.Hash) error {
}
defer atomic.StoreInt32(&d.synchronising, 0)
+ // If the head hash is banned, terminate immediately
+ if d.banned.Has(hash) {
+ return ErrInvalidChain
+ }
// Post a user notification of the sync (only once per session)
if atomic.CompareAndSwapInt32(&d.notified, 0, 1) {
glog.V(logger.Info).Infoln("Block synchronisation started")