break error

This commit is contained in:
zgfzgf 2020-09-22 15:21:35 +08:00
parent 46ed0142db
commit 001ba17d37

View File

@ -151,6 +151,7 @@ func (m *Miner) mine(ctx context.Context) {
var lastBase MiningBase
for {
minerStop:
select {
case <-m.stop:
stopping := m.stopping
@ -171,7 +172,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) {
break
goto minerStop
}
continue
}
@ -203,7 +204,7 @@ func (m *Miner) mine(ctx context.Context) {
if err != nil {
log.Errorf("failed getting beacon entry: %s", err)
if !m.niceSleep(time.Second) {
break
goto minerStop
}
continue
}
@ -214,7 +215,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) {
break
goto minerStop
}
continue
}
@ -225,7 +226,7 @@ func (m *Miner) mine(ctx context.Context) {
if err != nil {
log.Errorf("mining block failed: %+v", err)
if !m.niceSleep(time.Second) {
break
goto minerStop
}
onDone(false, 0, err)
continue