diff options
author | Ha ĐANG <dvietha@gmail.com> | 2019-01-04 15:48:15 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2019-01-04 15:48:15 +0800 |
commit | 3f421aca54bb5216e0f949966481fa4516c52273 (patch) | |
tree | fb8c1c3fc902bebde83af646ad452c2ce66e5457 /cmd/puppeth | |
parent | 49975264a8d37aa9af1a2b71015059245c0c2e0b (diff) | |
download | dexon-3f421aca54bb5216e0f949966481fa4516c52273.tar dexon-3f421aca54bb5216e0f949966481fa4516c52273.tar.gz dexon-3f421aca54bb5216e0f949966481fa4516c52273.tar.bz2 dexon-3f421aca54bb5216e0f949966481fa4516c52273.tar.lz dexon-3f421aca54bb5216e0f949966481fa4516c52273.tar.xz dexon-3f421aca54bb5216e0f949966481fa4516c52273.tar.zst dexon-3f421aca54bb5216e0f949966481fa4516c52273.zip |
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
Diffstat (limited to 'cmd/puppeth')
-rw-r--r-- | cmd/puppeth/genesis.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd/puppeth/genesis.go b/cmd/puppeth/genesis.go index 1025dfe82..c95c81a6d 100644 --- a/cmd/puppeth/genesis.go +++ b/cmd/puppeth/genesis.go @@ -174,7 +174,11 @@ func (spec *alethGenesisSpec) setPrecompile(address byte, data *alethGenesisSpec if spec.Accounts == nil { 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) { |