core/state: do not ignore null addr while iterative dump (#27320)

fixes bug which caused the zero-address to be ignored during an iterative state-dump.

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
This commit is contained in:
Park Changwan
2023-05-23 06:10:26 -04:00
committed by GitHub
co-authored by Martin Holst Swende
parent a190da9d68
commit bfded65ed8
3 changed files with 60 additions and 16 deletions
+5 -2
View File
@@ -389,7 +389,10 @@ type Alloc map[common.Address]core.GenesisAccount
func (g Alloc) OnRoot(common.Hash) {}
func (g Alloc) OnAccount(addr common.Address, dumpAccount state.DumpAccount) {
func (g Alloc) OnAccount(addr *common.Address, dumpAccount state.DumpAccount) {
if addr == nil {
return
}
balance, _ := new(big.Int).SetString(dumpAccount.Balance, 10)
var storage map[common.Hash]common.Hash
if dumpAccount.Storage != nil {
@@ -404,7 +407,7 @@ func (g Alloc) OnAccount(addr common.Address, dumpAccount state.DumpAccount) {
Balance: balance,
Nonce: dumpAccount.Nonce,
}
g[addr] = genesisAccount
g[*addr] = genesisAccount
}
// saveFile marshals the object to the given file