miner: Alos check lastbase ticket
This commit is contained in:
parent
30d7a714a9
commit
14d88d27b4
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user