Commit 3f421aca authored by Ha ĐANG's avatar Ha ĐANG Committed by Péter Szilágyi

cmd/puppeth: fix panic error when export aleth genesis wo/ precompile-addresses (#18344)

* cmd/puppeth: fix panic error when export aleth genesis wo/ precompile-addresses

* cmd/puppeth: don't need to handle duplicate set
parent 49975264
...@@ -174,7 +174,11 @@ func (spec *alethGenesisSpec) setPrecompile(address byte, data *alethGenesisSpec ...@@ -174,7 +174,11 @@ func (spec *alethGenesisSpec) setPrecompile(address byte, data *alethGenesisSpec
if spec.Accounts == nil { if spec.Accounts == nil {
spec.Accounts = make(map[common.UnprefixedAddress]*alethGenesisSpecAccount) spec.Accounts = make(map[common.UnprefixedAddress]*alethGenesisSpecAccount)
} }
spec.Accounts[common.UnprefixedAddress(common.BytesToAddress([]byte{address}))].Precompiled = data addr := common.UnprefixedAddress(common.BytesToAddress([]byte{address}))
if _, exist := spec.Accounts[addr]; !exist {
spec.Accounts[addr] = &alethGenesisSpecAccount{}
}
spec.Accounts[addr].Precompiled = data
} }
func (spec *alethGenesisSpec) setAccount(address common.Address, account core.GenesisAccount) { func (spec *alethGenesisSpec) setAccount(address common.Address, account core.GenesisAccount) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment