diff --git a/cmd/cpuminerd/mine.go b/cmd/cpuminerd/mine.go index bdd078f..7b399ec 100644 --- a/cmd/cpuminerd/mine.go +++ b/cmd/cpuminerd/mine.go @@ -86,7 +86,7 @@ func mineBlock(ctx context.Context, cs consensus.State, txns []types.Transaction return case <-time.After(10 * time.Second): rate := float64(atomic.LoadUint64(&hashes)) / time.Since(start).Seconds() - log.Debug("mining", zap.Float64("rate", rate), zap.Int("workers", workers)) + log.Info("mining", zap.Float64("rate", rate), zap.Int("workers", workers)) } } }() @@ -95,8 +95,8 @@ func mineBlock(ctx context.Context, cs consensus.State, txns []types.Transaction for i := 0; i < workers; i++ { workerBuf := make([]byte, len(buf)) copy(workerBuf, buf) + log := log.With(zap.Int("worker", i+1)) go func(n int, nonce uint64, buf []byte) { - for { select { case <-ctx.Done(): @@ -106,9 +106,10 @@ func mineBlock(ctx context.Context, cs consensus.State, txns []types.Transaction h := types.BlockID(types.HashBytes(buf)) atomic.AddUint64(&hashes, 1) if h.CmpWork(cs.ChildTarget) < 0 { + log.Debug("bad nonce", zap.Uint64("nonce", nonce)) continue } - + log.Debug("found nonce", zap.Uint64("nonce", nonce)) select { case resultCh <- nonce: default: