core: store genesis allocation and recommit them if necessary (#24460)
* core: store genesis allocation and recommit them if necessary * core: recover predefined genesis allocation if possible
This commit is contained in:
@ -81,6 +81,19 @@ func WriteChainConfig(db ethdb.KeyValueWriter, hash common.Hash, cfg *params.Cha
|
||||
}
|
||||
}
|
||||
|
||||
// ReadGenesisState retrieves the genesis state based on the given genesis hash.
|
||||
func ReadGenesisState(db ethdb.KeyValueReader, hash common.Hash) []byte {
|
||||
data, _ := db.Get(genesisKey(hash))
|
||||
return data
|
||||
}
|
||||
|
||||
// WriteGenesisState writes the genesis state into the disk.
|
||||
func WriteGenesisState(db ethdb.KeyValueWriter, hash common.Hash, data []byte) {
|
||||
if err := db.Put(genesisKey(hash), data); err != nil {
|
||||
log.Crit("Failed to store genesis state", "err", err)
|
||||
}
|
||||
}
|
||||
|
||||
// crashList is a list of unclean-shutdown-markers, for rlp-encoding to the
|
||||
// database
|
||||
type crashList struct {
|
||||
|
Reference in New Issue
Block a user