From 887bf0511f4215511ecd2ba8f00c659cf6e73de8 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Mon, 6 Jul 2020 13:45:26 +0200 Subject: [PATCH] fix signature for NewTestMiner --- lotus-soup/testkit/node.go | 2 +- lotus-soup/testkit/role_miner.go | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lotus-soup/testkit/node.go b/lotus-soup/testkit/node.go index ecfbcb755..c58397dd8 100644 --- a/lotus-soup/testkit/node.go +++ b/lotus-soup/testkit/node.go @@ -54,7 +54,7 @@ type LotusNode struct { FullApi api.FullNode MinerApi api.StorageMiner StopFn node.StopFunc - MineOne func(context.Context, func(bool)) error + MineOne func(context.Context, func(bool, error)) error } func (n *LotusNode) setWallet(ctx context.Context, walletKey *wallet.Key) error { diff --git a/lotus-soup/testkit/role_miner.go b/lotus-soup/testkit/role_miner.go index 869b97546..23dd1d52d 100644 --- a/lotus-soup/testkit/role_miner.go +++ b/lotus-soup/testkit/role_miner.go @@ -197,10 +197,10 @@ func PrepareMiner(t *TestEnvironment) (*LotusMiner, error) { } if t.StringParam("mining_mode") != "natural" { - mineBlock := make(chan func(bool)) + mineBlock := make(chan func(bool, error)) minerOpts = append(minerOpts, node.Override(new(*miner.Miner), miner.NewTestMiner(mineBlock, minerAddr))) - n.MineOne = func(ctx context.Context, cb func(bool)) error { + n.MineOne = func(ctx context.Context, cb func(bool, error)) error { select { case mineBlock <- cb: return nil @@ -352,7 +352,11 @@ func (m *LotusMiner) RunDefault() error { t.SyncClient.MustSignalAndWait(ctx, stateMineNext, miners) ch := make(chan struct{}) - err := m.MineOne(ctx, func(mined bool) { + err := m.MineOne(ctx, func(mined bool, err error) { + if err != nil { + t.D().Counter("block.mine.err").Inc(1) + return + } if mined { t.D().Counter(fmt.Sprintf("block.mine,miner=%s", myActorAddr)).Inc(1) }