From 14d88d27b467f9e6adb47375d1b0ad488cf5bf0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 10 Oct 2019 04:03:42 +0200 Subject: [PATCH] miner: Alos check lastbase ticket --- miner/miner.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/miner/miner.go b/miner/miner.go index f69d124dd..1a7a6c3c7 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -131,7 +131,7 @@ func (m *Miner) mine(ctx context.Context) { ctx, span := trace.StartSpan(ctx, "/mine") defer span.End() - var lastBase *types.TipSet + var lastBase MiningBase for { select { @@ -159,12 +159,12 @@ func (m *Miner) mine(ctx context.Context) { log.Errorf("failed to get best mining candidate: %s", err) continue } - if base.ts.Equals(lastBase) { - log.Error("BestMiningCandidate from the previous round: %s", lastBase.Cids()) - time.Sleep(build.BlockDelay) + if base.ts.Equals(lastBase.ts) && len(lastBase.tickets) == len(base.tickets) { + log.Error("BestMiningCandidate from the previous round: %s (tkts:%d)", lastBase.ts.Cids(), len(lastBase.tickets)) + time.Sleep(build.BlockDelay * time.Second) continue } - lastBase = base.ts + lastBase = *base b, err := m.mineOne(ctx, base) if err != nil { @@ -219,7 +219,7 @@ func (m *Miner) GetBestMiningCandidate() (*MiningBase, error) { } func (m *Miner) mineOne(ctx context.Context, base *MiningBase) (*types.BlockMsg, error) { - log.Debug("attempting to mine a block on:", base.ts.Cids()) + log.Info("attempting to mine a block on:", base.ts.Cids()) ticket, err := m.scratchTicket(ctx, base) if err != nil { return nil, errors.Wrap(err, "scratching ticket failed")