From 0cd0ef29d9870b2371e093aa496f8ce60bb1c077 Mon Sep 17 00:00:00 2001 From: Aaron Buchwald Date: Sat, 26 Aug 2023 19:27:18 -0400 Subject: [PATCH] core: remove unnecessary check that storedcfg matches newcfg before writing to disk --- core/genesis.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/core/genesis.go b/core/genesis.go index 86a3e42a62..2220f8a192 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -367,7 +367,6 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *trie.Database, gen rawdb.WriteChainConfig(db, stored, newcfg) return newcfg, stored, nil } - storedData, _ := json.Marshal(storedcfg) // Special case: if a private network is being used (no genesis and also no // mainnet hash in the database), we must not apply the `configOrDefault` // chain config as that would be AllProtocolChanges (applying any new fork @@ -387,10 +386,7 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *trie.Database, gen if compatErr != nil && ((head.Number.Uint64() != 0 && compatErr.RewindToBlock != 0) || (head.Time != 0 && compatErr.RewindToTime != 0)) { return newcfg, stored, compatErr } - // Don't overwrite if the old is identical to the new - if newData, _ := json.Marshal(newcfg); !bytes.Equal(storedData, newData) { - rawdb.WriteChainConfig(db, stored, newcfg) - } + rawdb.WriteChainConfig(db, stored, newcfg) return newcfg, stored, nil }