Skip to content

Commit 702bef8

Browse files
committed
cmd/geth, eth: drop bad block reporting, its offline anyway
1 parent d83a9a8 commit 702bef8

3 files changed

Lines changed: 2 additions & 96 deletions

File tree

‎cmd/geth/main.go‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,6 @@ func init() {
165165
// Start system runtime metrics collection
166166
go metrics.CollectProcessMetrics(3 * time.Second)
167167

168-
// This should be the only place where reporting is enabled
169-
// because it is not intended to run while testing.
170-
// In addition to this check, bad block reports are sent only
171-
// for chains with the main network genesis block and network id 1.
172-
eth.EnableBadBlockReporting = true
173-
174168
utils.SetupNetwork(ctx)
175169
return nil
176170
}

‎eth/bad_block.go‎

Lines changed: 0 additions & 73 deletions
This file was deleted.

‎eth/handler.go‎

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ type ProtocolManager struct {
9292
// wait group is used for graceful shutdowns during downloading
9393
// and processing
9494
wg sync.WaitGroup
95-
96-
badBlockReportingEnabled bool
9795
}
9896

9997
// NewProtocolManager returns a new ethereum sub protocol manager. The Ethereum sub protocol manages peers capable
@@ -163,7 +161,7 @@ func NewProtocolManager(config *params.ChainConfig, fastSync bool, networkId int
163161
// Construct the different synchronisation mechanisms
164162
manager.downloader = downloader.New(downloader.FullSync, chaindb, manager.eventMux, blockchain.HasHeader, blockchain.HasBlockAndState, blockchain.GetHeaderByHash,
165163
blockchain.GetBlockByHash, blockchain.CurrentHeader, blockchain.CurrentBlock, blockchain.CurrentFastBlock, blockchain.FastSyncCommitHead,
166-
blockchain.GetTdByHash, blockchain.InsertHeaderChain, manager.insertChain, blockchain.InsertReceiptChain, blockchain.Rollback,
164+
blockchain.GetTdByHash, blockchain.InsertHeaderChain, manager.blockchain.InsertChain, blockchain.InsertReceiptChain, blockchain.Rollback,
167165
manager.removePeer)
168166

169167
validator := func(header *types.Header) error {
@@ -174,26 +172,13 @@ func NewProtocolManager(config *params.ChainConfig, fastSync bool, networkId int
174172
}
175173
inserter := func(blocks types.Blocks) (int, error) {
176174
atomic.StoreUint32(&manager.synced, 1) // Mark initial sync done on any fetcher import
177-
return manager.insertChain(blocks)
175+
return manager.blockchain.InsertChain(blocks)
178176
}
179177
manager.fetcher = fetcher.New(blockchain.GetBlockByHash, validator, manager.BroadcastBlock, heighter, inserter, manager.removePeer)
180178

181-
if blockchain.Genesis().Hash().Hex() == defaultGenesisHash && networkId == 1 {
182-
log.Debug("Bad block reporting is enabled")
183-
manager.badBlockReportingEnabled = true
184-
}
185-
186179
return manager, nil
187180
}
188181

189-
func (pm *ProtocolManager) insertChain(blocks types.Blocks) (i int, err error) {
190-
i, err = pm.blockchain.InsertChain(blocks)
191-
if pm.badBlockReportingEnabled && core.IsValidationErr(err) && i < len(blocks) {
192-
go sendBadBlockReport(blocks[i], err)
193-
}
194-
return i, err
195-
}
196-
197182
func (pm *ProtocolManager) removePeer(id string) {
198183
// Short circuit if the peer was already removed
199184
peer := pm.peers.Peer(id)

0 commit comments

Comments
 (0)