diff --git a/core/headerchain.go b/core/headerchain.go index f21dcf537e..e9c04c6546 100644 --- a/core/headerchain.go +++ b/core/headerchain.go @@ -165,7 +165,9 @@ func (hc *HeaderChain) WriteHeader(header *types.Header) (status WriteStatus, er // 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 - if externTd.Cmp(localTd) > 0 || (externTd.Cmp(localTd) == 0 && mrand.Float64() < 0.5) { + if externTd.Cmp(localTd) > 0 || + (externTd.Cmp(localTd) == 0 && header.Number.Uint64() < hc.CurrentHeader().Number.Uint64()) || + (externTd.Cmp(localTd) == 0 && mrand.Float64() < 0.5) { // If the header can be added into canonical chain, adjust the // header chain markers(canonical indexes and head header flag). //