Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allocate funds in testing.MakeGenesis #90

Merged
merged 1 commit into from
Jul 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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