aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorHa ĐANG <dvietha@gmail.com>2019-01-04 15:48:15 +0800
committerPéter Szilágyi <peterke@gmail.com>2019-01-04 15:48:15 +0800
commit3f421aca54bb5216e0f949966481fa4516c52273 (patch)
treefb8c1c3fc902bebde83af646ad452c2ce66e5457 /cmd
parent49975264a8d37aa9af1a2b71015059245c0c2e0b (diff)
downloadgo-tangerine-3f421aca54bb5216e0f949966481fa4516c52273.tar
go-tangerine-3f421aca54bb5216e0f949966481fa4516c52273.tar.gz
go-tangerine-3f421aca54bb5216e0f949966481fa4516c52273.tar.bz2
go-tangerine-3f421aca54bb5216e0f949966481fa4516c52273.tar.lz
go-tangerine-3f421aca54bb5216e0f949966481fa4516c52273.tar.xz
go-tangerine-3f421aca54bb5216e0f949966481fa4516c52273.tar.zst
go-tangerine-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')
-rw-r--r--cmd/puppeth/genesis.go6
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) {