From 3dddcb85e7c0d686548f209368e912a8c7912125 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Thu, 28 Nov 2019 20:41:37 -0800 Subject: [PATCH] tests properly create miners, they just can't mine yet --- chain/gen/gen.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/chain/gen/gen.go b/chain/gen/gen.go index 9eb841e31..e882dd424 100644 --- a/chain/gen/gen.go +++ b/chain/gen/gen.go @@ -112,16 +112,6 @@ func NewGenerator() (*ChainGen, error) { return nil, xerrors.Errorf("creating memrepo wallet failed: %w", err) } - worker1, err := w.GenerateKey(types.KTBLS) - if err != nil { - return nil, xerrors.Errorf("failed to generate worker key: %w", err) - } - - worker2, err := w.GenerateKey(types.KTBLS) - if err != nil { - return nil, xerrors.Errorf("failed to generate worker key: %w", err) - } - banker, err := w.GenerateKey(types.KTSecp256k1) if err != nil { return nil, xerrors.Errorf("failed to generate banker key: %w", err) @@ -167,18 +157,28 @@ func NewGenerator() (*ChainGen, error) { return nil, err } + mk1, err := w.Import(&genm1.Key) + if err != nil { + return nil, err + } + mk2, err := w.Import(&genm2.Key) + if err != nil { + return nil, err + } + minercfg := &GenMinerCfg{ PeerIDs: []peer.ID{"peerID1", "peerID2"}, PreSeals: map[string]genesis.GenesisMiner{ maddr1.String(): *genm1, maddr2.String(): *genm2, }, + MinerAddrs: []address.Address{maddr1, maddr2}, } genb, err := MakeGenesisBlock(bs, map[address.Address]types.BigInt{ - worker1: types.FromFil(40000), - worker2: types.FromFil(40000), - banker: types.FromFil(50000), + mk1: types.FromFil(40000), + mk2: types.FromFil(40000), + banker: types.FromFil(50000), }, minercfg, 100000) if err != nil { return nil, xerrors.Errorf("make genesis block failed: %w", err)