From 590b5f029966d0a6e5a2e80c67529c639ecef6f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 26 Jul 2019 14:51:32 +0200 Subject: [PATCH] Allocate funds in testing.MakeGenesis --- node/modules/testing/genesis.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/node/modules/testing/genesis.go b/node/modules/testing/genesis.go index dac961aa73..3b9ce0e9c1 100644 --- a/node/modules/testing/genesis.go +++ b/node/modules/testing/genesis.go @@ -14,6 +14,7 @@ import ( "github.com/ipfs/go-merkledag" "github.com/filecoin-project/go-lotus/chain" + "github.com/filecoin-project/go-lotus/chain/address" "github.com/filecoin-project/go-lotus/chain/gen" "github.com/filecoin-project/go-lotus/chain/types" "github.com/filecoin-project/go-lotus/node/modules" @@ -47,8 +48,16 @@ func MakeGenesis(outFile string) func(bs blockstore.Blockstore, w *chain.Wallet) return func(bs blockstore.Blockstore, w *chain.Wallet) modules.Genesis { return func() (*types.BlockHeader, error) { glog.Warn("Generating new random genesis block, note that this SHOULD NOT happen unless you are setting up new network") - // TODO: make an address allocation - b, err := gen.MakeGenesisBlock(bs, nil) + minerAddr, err := w.GenerateKey(types.KTSecp256k1) + if err != nil { + return nil, err + } + + addrs := map[address.Address]types.BigInt{ + minerAddr: types.NewInt(50000000), + } + + b, err := gen.MakeGenesisBlock(bs, addrs) if err != nil { return nil, err }