Skip to content

Commit

Permalink
change minerStop to minerLoop
Browse files Browse the repository at this point in the history
  • Loading branch information
zgfzgf committed Sep 23, 2020
1 parent 001ba17 commit a4ade15
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions miner/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,8 @@ func (m *Miner) mine(ctx context.Context) {
defer span.End()

var lastBase MiningBase

minerLoop:
for {
minerStop:
select {
case <-m.stop:
stopping := m.stopping
Expand All @@ -172,7 +171,7 @@ func (m *Miner) mine(ctx context.Context) {
if err != nil {
log.Errorf("failed to get best mining candidate: %s", err)
if !m.niceSleep(time.Second * 5) {
goto minerStop
goto minerLoop
}
continue
}
Expand Down Expand Up @@ -204,7 +203,7 @@ func (m *Miner) mine(ctx context.Context) {
if err != nil {
log.Errorf("failed getting beacon entry: %s", err)
if !m.niceSleep(time.Second) {
goto minerStop
goto minerLoop
}
continue
}
Expand All @@ -215,7 +214,7 @@ func (m *Miner) mine(ctx context.Context) {
if base.TipSet.Equals(lastBase.TipSet) && lastBase.NullRounds == base.NullRounds {
log.Warnf("BestMiningCandidate from the previous round: %s (nulls:%d)", lastBase.TipSet.Cids(), lastBase.NullRounds)
if !m.niceSleep(time.Duration(build.BlockDelaySecs) * time.Second) {
goto minerStop
goto minerLoop
}
continue
}
Expand All @@ -226,7 +225,7 @@ func (m *Miner) mine(ctx context.Context) {
if err != nil {
log.Errorf("mining block failed: %+v", err)
if !m.niceSleep(time.Second) {
goto minerStop
goto minerLoop
}
onDone(false, 0, err)
continue
Expand Down

0 comments on commit a4ade15

Please sign in to comment.