miner: don't mine on the same base twice
This commit is contained in:
parent
3fd2f3da7a
commit
30d7a714a9
@ -103,7 +103,7 @@ func (syncer *Syncer) InformNewHead(from peer.ID, fts *store.FullTipSet) {
|
|||||||
log.Info("got block from ourselves")
|
log.Info("got block from ourselves")
|
||||||
|
|
||||||
if err := syncer.Sync(fts.TipSet()); err != nil {
|
if err := syncer.Sync(fts.TipSet()); err != nil {
|
||||||
log.Errorf("failed to sync our own block: %+v", err)
|
log.Errorf("failed to sync our own block %s: %+v", fts.TipSet().Cids(), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -131,6 +131,8 @@ func (m *Miner) mine(ctx context.Context) {
|
|||||||
ctx, span := trace.StartSpan(ctx, "/mine")
|
ctx, span := trace.StartSpan(ctx, "/mine")
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
|
var lastBase *types.TipSet
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-m.stop:
|
case <-m.stop:
|
||||||
@ -157,6 +159,12 @@ func (m *Miner) mine(ctx context.Context) {
|
|||||||
log.Errorf("failed to get best mining candidate: %s", err)
|
log.Errorf("failed to get best mining candidate: %s", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if base.ts.Equals(lastBase) {
|
||||||
|
log.Error("BestMiningCandidate from the previous round: %s", lastBase.Cids())
|
||||||
|
time.Sleep(build.BlockDelay)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
lastBase = base.ts
|
||||||
|
|
||||||
b, err := m.mineOne(ctx, base)
|
b, err := m.mineOne(ctx, base)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user