forked from cerc-io/plugeth
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:
@@ -61,6 +61,6 @@ func StartENRUpdater(chain *core.BlockChain, ln *enode.LocalNode) {
|
||||
func currentENREntry(chain *core.BlockChain) *enrEntry {
|
||||
head := chain.CurrentHeader()
|
||||
return &enrEntry{
|
||||
ForkID: forkid.NewID(chain.Config(), chain.Genesis().Hash(), head.Number.Uint64(), head.Time),
|
||||
ForkID: forkid.NewID(chain.Config(), chain.Genesis(), head.Number.Uint64(), head.Time),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ func testHandshake(t *testing.T, protocol uint) {
|
||||
genesis = backend.chain.Genesis()
|
||||
head = backend.chain.CurrentBlock()
|
||||
td = backend.chain.GetTd(head.Hash(), head.Number.Uint64())
|
||||
forkID = forkid.NewID(backend.chain.Config(), backend.chain.Genesis().Hash(), backend.chain.CurrentHeader().Number.Uint64(), backend.chain.CurrentHeader().Time)
|
||||
forkID = forkid.NewID(backend.chain.Config(), backend.chain.Genesis(), backend.chain.CurrentHeader().Number.Uint64(), backend.chain.CurrentHeader().Time)
|
||||
)
|
||||
tests := []struct {
|
||||
code uint64
|
||||
|
||||
Reference in New Issue
Block a user