Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions core/forkchoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ func (f *ForkChoice) ReorgNeeded(current *types.Header, header *types.Header) (b
if ttd := f.chain.Config().TerminalTotalDifficulty; ttd != nil && ttd.Cmp(externTd) <= 0 {
return true, nil
}

if current.Number.Cmp(header.Number) == 0 {
// Reject single-block reorgs to mitigate uncle maker attack.
// Refer to https://eprint.iacr.org/2022/1020 for more info.
return false, nil
}

// If the total difficulty is higher than our known, add it to the canonical chain
// Second clause in the if statement reduces the vulnerability to selfish mining.
// Please refer to http://www.cs.cornell.edu/~ie53/publications/btcProcFC.pdf
Expand Down