From afdd23b5cab227ae6edef3d78ec74b05c7872b55 Mon Sep 17 00:00:00 2001 From: Péter Szilágyi Date: Fri, 26 May 2017 16:04:12 +0300 Subject: eth: don't import propagated blocks during fastsync --- eth/handler.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'eth/handler.go') diff --git a/eth/handler.go b/eth/handler.go index 16e371227..8c2f5660d 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -171,6 +171,11 @@ func NewProtocolManager(config *params.ChainConfig, mode downloader.SyncMode, ne return blockchain.CurrentBlock().NumberU64() } inserter := func(blocks types.Blocks) (int, error) { + // If fast sync is running, deny importing weird blocks + if atomic.LoadUint32(&manager.fastSync) == 1 { + log.Warn("Discarded bad propagated block", "number", blocks[0].Number(), "hash", blocks[0].Hash()) + return 0, nil + } atomic.StoreUint32(&manager.acceptTxs, 1) // Mark initial sync done on any fetcher import return manager.blockchain.InsertChain(blocks) } -- cgit