Skip to content

Commit

Permalink
Added fetcher limit for block imports as a DDos prevention mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
gameofpointers committed Sep 12, 2023
1 parent c45b913 commit ff5b5e1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion eth/fetcher/block_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,12 @@ func (f *BlockFetcher) loop() {
f.forgetBlock(hash)
continue
}
f.importBlocks(op.origin, op.block)

// Only import blocks using the Fetcher if its within maxUncleDist
// This is done to prevent DDos on the append queue
if op != nil && op.block.NumberU64()+maxUncleDist > f.chainHeight() {
f.importBlocks(op.origin, op.block)
}
}
// Wait for an outside event to occur
select {
Expand Down

0 comments on commit ff5b5e1

Please sign in to comment.