mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
core/genesis: panic if overwrite precompiled account
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
39206842f2
commit
bb52ad61fb
1 changed files with 9 additions and 3 deletions
|
|
@ -608,18 +608,24 @@ func DeveloperGenesisBlock(gasLimit uint64, faucet common.Address, genesisAlloc
|
|||
common.BytesToAddress([]byte{7}): {Balance: big.NewInt(1)}, // ECScalarMul
|
||||
common.BytesToAddress([]byte{8}): {Balance: big.NewInt(1)}, // ECPairing
|
||||
common.BytesToAddress([]byte{9}): {Balance: big.NewInt(1)}, // BLAKE2b
|
||||
faucet: {Balance: new(big.Int).Sub(new(big.Int).Lsh(big.NewInt(1), 256), big.NewInt(9))},
|
||||
}
|
||||
|
||||
if genesisAlloc != nil {
|
||||
precompiled := map[common.Address]struct{}{}
|
||||
for addr := range alloc {
|
||||
precompiled[addr] = struct{}{}
|
||||
}
|
||||
for addr, account := range *genesisAlloc {
|
||||
// Don't overwrite the precompiled accounts
|
||||
if _, ok := alloc[addr]; !ok {
|
||||
alloc[addr] = account
|
||||
if _, ok := precompiled[addr]; ok {
|
||||
log.Crit("DeveloperGenesisBlock: can't overwrite precompiled account", "address", addr)
|
||||
}
|
||||
alloc[addr] = account
|
||||
}
|
||||
}
|
||||
|
||||
alloc[faucet] = GenesisAccount{Balance: new(big.Int).Sub(new(big.Int).Lsh(big.NewInt(1), 256), big.NewInt(9))}
|
||||
|
||||
// Assemble and return the genesis with the precompiles and faucet pre-funded
|
||||
return &Genesis{
|
||||
Config: &config,
|
||||
|
|
|
|||
Loading…
Reference in a new issue