core/forkid: correctly compute forkid when timestamp fork is activated in genesis (#27895)

This changes the forkID calculation to ignore time-based forks that occurred before the
genesis block. It's supposed to be done this way because the spec says:

> If a chain is configured to start with a non-Frontier ruleset already in its genesis, that is NOT considered a fork.
This commit is contained in:
lightclient
2023-08-16 23:31:02 +02:00
committed by GitHub
parent a3e35414b7
commit 32fde3f838
10 changed files with 76 additions and 16 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ func (c *Chain) RootAt(height int) common.Hash {
// ForkID gets the fork id of the chain.
func (c *Chain) ForkID() forkid.ID {
return forkid.NewID(c.chainConfig, c.blocks[0].Hash(), uint64(c.Len()), c.blocks[0].Time())
return forkid.NewID(c.chainConfig, c.blocks[0], uint64(c.Len()), c.blocks[0].Time())
}
// Shorten returns a copy chain of a desired height from the imported