From 884dca9edc0c342d2c11d878ad321ca2799d016b Mon Sep 17 00:00:00 2001 From: Shane Bammel Date: Fri, 14 May 2021 14:02:01 -0500 Subject: [PATCH 1/2] forkid: added failing test --- core/forkid/forkid_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/forkid/forkid_test.go b/core/forkid/forkid_test.go index a20598fa9daa..2a7938bd297c 100644 --- a/core/forkid/forkid_test.go +++ b/core/forkid/forkid_test.go @@ -163,6 +163,10 @@ func TestValidation(t *testing.T) { // neither forks passed at neither nodes, they may mismatch, but we still connect for now. {7279999, ID{Hash: checksumToBytes(0xa00bc324), Next: math.MaxUint64}, nil}, + // Local is mainnet exactly on Petersburg, remote announces Byzantium + knowledge about Petersburg. Remote + // is simply out of sync, accept. + {7280000, ID{Hash: checksumToBytes(0xa00bc324), Next: 7280000}, nil}, + // Local is mainnet Petersburg, remote announces Byzantium + knowledge about Petersburg. Remote // is simply out of sync, accept. {7987396, ID{Hash: checksumToBytes(0xa00bc324), Next: 7280000}, nil}, From e61c2e306a89737f977439019e0ed9dea80d5cda Mon Sep 17 00:00:00 2001 From: Shane Bammel Date: Fri, 14 May 2021 14:02:15 -0500 Subject: [PATCH 2/2] forkid: fixed off-by-one bug --- core/forkid/forkid.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/forkid/forkid.go b/core/forkid/forkid.go index 1bf3406828f0..f56ce85feeed 100644 --- a/core/forkid/forkid.go +++ b/core/forkid/forkid.go @@ -155,7 +155,7 @@ func newFilter(config *params.ChainConfig, genesis common.Hash, headfn func() ui for i, fork := range forks { // If our head is beyond this fork, continue to the next (we have a dummy // fork of maxuint64 as the last item to always fail this check eventually). - if head > fork { + if head >= fork { continue } // Found the first unpassed fork block, check if our current state matches