container, genesis: use common.Address in genesis alloc option
This commit is contained in:
parent
cbac4e7d0b
commit
afbb66ac07
|
@ -512,9 +512,14 @@ func (bc *blockchain) generateAccounts(num int) {
|
|||
func (bc *blockchain) setupGenesis(addrs []common.Address) {
|
||||
balance, _ := new(big.Int).SetString(allocBalance, 10)
|
||||
if bc.genesisFile == "" {
|
||||
var allocAddrs []common.Address
|
||||
allocAddrs = append(allocAddrs, addrs...)
|
||||
for _, acc := range bc.accounts {
|
||||
allocAddrs = append(allocAddrs, acc.Address)
|
||||
}
|
||||
bc.genesisFile = genesis.NewFile(bc.isQuorum,
|
||||
genesis.Validators(addrs...),
|
||||
genesis.Alloc(bc.accounts, balance),
|
||||
genesis.Alloc(allocAddrs, balance),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ package genesis
|
|||
import (
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/accounts"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
|
@ -47,11 +46,11 @@ func GasLimit(limit uint64) Option {
|
|||
}
|
||||
}
|
||||
|
||||
func Alloc(accounts []accounts.Account, balance *big.Int) Option {
|
||||
func Alloc(addrs []common.Address, balance *big.Int) Option {
|
||||
return func(genesis *core.Genesis) {
|
||||
alloc := make(map[common.Address]core.GenesisAccount)
|
||||
for _, a := range accounts {
|
||||
alloc[a.Address] = core.GenesisAccount{Balance: balance}
|
||||
for _, addr := range addrs {
|
||||
alloc[addr] = core.GenesisAccount{Balance: balance}
|
||||
}
|
||||
genesis.Alloc = alloc
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue