Skip to content

Commit

Permalink
Merge pull request #90 from filecoin-project/fix/testgenesis
Browse files Browse the repository at this point in the history
Allocate funds in testing.MakeGenesis
  • Loading branch information
magik6k committed Jul 26, 2019
2 parents 0c6a8f8 + 590b5f0 commit faefb9c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions node/modules/testing/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit faefb9c

Please sign in to comment.