fix signature for NewTestMiner

This commit is contained in:
Anton Evangelatov 2020-07-06 13:45:26 +02:00
parent f529f3b14d
commit 887bf0511f
2 changed files with 8 additions and 4 deletions

View File

@ -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 {

View File

@ -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)
}