mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
cmd/geth: read dev.alloc file
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
86cfddab5b
commit
f4c9b9f32f
2 changed files with 21 additions and 13 deletions
|
|
@ -135,6 +135,7 @@ var (
|
||||||
utils.DeveloperFlag,
|
utils.DeveloperFlag,
|
||||||
utils.DeveloperGasLimitFlag,
|
utils.DeveloperGasLimitFlag,
|
||||||
utils.DeveloperPeriodFlag,
|
utils.DeveloperPeriodFlag,
|
||||||
|
utils.DeveloperAllocFlag,
|
||||||
utils.VMEnableDebugFlag,
|
utils.VMEnableDebugFlag,
|
||||||
utils.NetworkIdFlag,
|
utils.NetworkIdFlag,
|
||||||
utils.EthStatsURLFlag,
|
utils.EthStatsURLFlag,
|
||||||
|
|
|
||||||
|
|
@ -595,17 +595,10 @@ func DefaultHoleskyGenesisBlock() *Genesis {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeveloperGenesisBlock returns the 'geth --dev' genesis block.
|
// DeveloperGenesisBlock returns the 'geth --dev' genesis block.
|
||||||
func DeveloperGenesisBlock(gasLimit uint64, faucet common.Address) *Genesis {
|
func DeveloperGenesisBlock(gasLimit uint64, faucet common.Address, genesisAlloc *GenesisAlloc) *Genesis {
|
||||||
// Override the default period to the user requested one
|
// Override the default period to the user requested one
|
||||||
config := *params.AllDevChainProtocolChanges
|
config := *params.AllDevChainProtocolChanges
|
||||||
|
alloc := map[common.Address]GenesisAccount{
|
||||||
// Assemble and return the genesis with the precompiles and faucet pre-funded
|
|
||||||
return &Genesis{
|
|
||||||
Config: &config,
|
|
||||||
GasLimit: gasLimit,
|
|
||||||
BaseFee: big.NewInt(params.InitialBaseFee),
|
|
||||||
Difficulty: big.NewInt(0),
|
|
||||||
Alloc: map[common.Address]GenesisAccount{
|
|
||||||
common.BytesToAddress([]byte{1}): {Balance: big.NewInt(1)}, // ECRecover
|
common.BytesToAddress([]byte{1}): {Balance: big.NewInt(1)}, // ECRecover
|
||||||
common.BytesToAddress([]byte{2}): {Balance: big.NewInt(1)}, // SHA256
|
common.BytesToAddress([]byte{2}): {Balance: big.NewInt(1)}, // SHA256
|
||||||
common.BytesToAddress([]byte{3}): {Balance: big.NewInt(1)}, // RIPEMD
|
common.BytesToAddress([]byte{3}): {Balance: big.NewInt(1)}, // RIPEMD
|
||||||
|
|
@ -616,7 +609,21 @@ func DeveloperGenesisBlock(gasLimit uint64, faucet common.Address) *Genesis {
|
||||||
common.BytesToAddress([]byte{8}): {Balance: big.NewInt(1)}, // ECPairing
|
common.BytesToAddress([]byte{8}): {Balance: big.NewInt(1)}, // ECPairing
|
||||||
common.BytesToAddress([]byte{9}): {Balance: big.NewInt(1)}, // BLAKE2b
|
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))},
|
faucet: {Balance: new(big.Int).Sub(new(big.Int).Lsh(big.NewInt(1), 256), big.NewInt(9))},
|
||||||
},
|
}
|
||||||
|
|
||||||
|
if genesisAlloc != nil {
|
||||||
|
for addr, account := range *genesisAlloc {
|
||||||
|
alloc[addr] = account
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assemble and return the genesis with the precompiles and faucet pre-funded
|
||||||
|
return &Genesis{
|
||||||
|
Config: &config,
|
||||||
|
GasLimit: gasLimit,
|
||||||
|
BaseFee: big.NewInt(params.InitialBaseFee),
|
||||||
|
Difficulty: big.NewInt(0),
|
||||||
|
Alloc: alloc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue