@@ -182,14 +182,14 @@ func SetupGenesisBlock(
182182 return newcfg , common.Hash {}, err
183183 }
184184
185- // Use the attached extras pointer to ensure upgrade bytes round-trip correctly .
186- extra := params .GetExtra (newcfg )
187- storedcfg := customrawdb .ReadChainConfig (db , stored , extra )
185+ // Read stored config into a local extras copy to avoid mutating shared extras concurrently .
186+ extraCopy := * params .GetExtra (newcfg )
187+ storedcfg := customrawdb .ReadChainConfig (db , stored , & extraCopy )
188188 // If there is no previously stored chain config, write the chain config to disk.
189189 if storedcfg == nil {
190190 // Note: this can happen since we did not previously write the genesis block and chain config in the same batch.
191191 log .Warn ("Found genesis block without chain config" )
192- customrawdb .WriteChainConfig (db , stored , newcfg , * extra )
192+ customrawdb .WriteChainConfig (db , stored , newcfg , * params . GetExtra ( newcfg ) )
193193 return newcfg , stored , nil
194194 }
195195
@@ -228,7 +228,7 @@ func SetupGenesisBlock(
228228 }
229229 // Required to write the chain config to disk to ensure both the chain config and upgrade bytes are persisted to disk.
230230 // Note: this intentionally removes an extra check from upstream.
231- customrawdb .WriteChainConfig (db , stored , newcfg , * extra )
231+ customrawdb .WriteChainConfig (db , stored , newcfg , * params . GetExtra ( newcfg ) )
232232 return newcfg , stored , nil
233233}
234234
0 commit comments