Remove few useless variable assignments
This commit is contained in:
parent
be3a8bd320
commit
c3a7b59bd1
@ -419,7 +419,7 @@ func (m *Miner) GetBestMiningCandidate(ctx context.Context) (*MiningBase, error)
|
|||||||
// 1.
|
// 1.
|
||||||
func (m *Miner) mineOne(ctx context.Context, base *MiningBase) (minedBlock *types.BlockMsg, err error) {
|
func (m *Miner) mineOne(ctx context.Context, base *MiningBase) (minedBlock *types.BlockMsg, err error) {
|
||||||
log.Debugw("attempting to mine a block", "tipset", types.LogCids(base.TipSet.Cids()))
|
log.Debugw("attempting to mine a block", "tipset", types.LogCids(base.TipSet.Cids()))
|
||||||
start := build.Clock.Now()
|
tStart := build.Clock.Now()
|
||||||
|
|
||||||
round := base.TipSet.Height() + base.NullRounds + 1
|
round := base.TipSet.Height() + base.NullRounds + 1
|
||||||
|
|
||||||
@ -439,13 +439,13 @@ func (m *Miner) mineOne(ctx context.Context, base *MiningBase) (minedBlock *type
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isLate := uint64(start.Unix()) > (base.TipSet.MinTimestamp() + uint64(base.NullRounds*builtin.EpochDurationSeconds) + build.PropagationDelaySecs)
|
isLate := uint64(tStart.Unix()) > (base.TipSet.MinTimestamp() + uint64(base.NullRounds*builtin.EpochDurationSeconds) + build.PropagationDelaySecs)
|
||||||
|
|
||||||
logStruct := []interface{}{
|
logStruct := []interface{}{
|
||||||
"tookMilliseconds", (build.Clock.Now().UnixNano() - start.UnixNano()) / 1_000_000,
|
"tookMilliseconds", (build.Clock.Now().UnixNano() - tStart.UnixNano()) / 1_000_000,
|
||||||
"forRound", int64(round),
|
"forRound", int64(round),
|
||||||
"baseEpoch", int64(base.TipSet.Height()),
|
"baseEpoch", int64(base.TipSet.Height()),
|
||||||
"baseDeltaSeconds", uint64(start.Unix()) - base.TipSet.MinTimestamp(),
|
"baseDeltaSeconds", uint64(tStart.Unix()) - base.TipSet.MinTimestamp(),
|
||||||
"nullRounds", int64(base.NullRounds),
|
"nullRounds", int64(base.NullRounds),
|
||||||
"lateStart", isLate,
|
"lateStart", isLate,
|
||||||
"beaconEpoch", rbase.Round,
|
"beaconEpoch", rbase.Round,
|
||||||
@ -480,16 +480,10 @@ func (m *Miner) mineOne(ctx context.Context, base *MiningBase) (minedBlock *type
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
tMBI := build.Clock.Now()
|
|
||||||
|
|
||||||
beaconPrev := mbi.PrevBeaconEntry
|
|
||||||
|
|
||||||
tDrand := build.Clock.Now()
|
|
||||||
bvals := mbi.BeaconEntries
|
|
||||||
|
|
||||||
tPowercheck := build.Clock.Now()
|
tPowercheck := build.Clock.Now()
|
||||||
|
|
||||||
rbase = beaconPrev
|
bvals := mbi.BeaconEntries
|
||||||
|
rbase = mbi.PrevBeaconEntry
|
||||||
if len(bvals) > 0 {
|
if len(bvals) > 0 {
|
||||||
rbase = bvals[len(bvals)-1]
|
rbase = bvals[len(bvals)-1]
|
||||||
}
|
}
|
||||||
@ -561,9 +555,7 @@ func (m *Miner) mineOne(ctx context.Context, base *MiningBase) (minedBlock *type
|
|||||||
log.Infow("mined new block", "cid", minedBlock.Cid(), "height", int64(minedBlock.Header.Height), "miner", minedBlock.Header.Miner, "parents", parentMiners, "parentTipset", base.TipSet.Key().String(), "took", dur)
|
log.Infow("mined new block", "cid", minedBlock.Cid(), "height", int64(minedBlock.Header.Height), "miner", minedBlock.Header.Miner, "parents", parentMiners, "parentTipset", base.TipSet.Key().String(), "took", dur)
|
||||||
if dur > time.Second*time.Duration(build.BlockDelaySecs) {
|
if dur > time.Second*time.Duration(build.BlockDelaySecs) {
|
||||||
log.Warnw("CAUTION: block production took longer than the block delay. Your computer may not be fast enough to keep up",
|
log.Warnw("CAUTION: block production took longer than the block delay. Your computer may not be fast enough to keep up",
|
||||||
"tMinerBaseInfo ", tMBI.Sub(start),
|
"tPowercheck ", tPowercheck.Sub(tStart),
|
||||||
"tDrand ", tDrand.Sub(tMBI),
|
|
||||||
"tPowercheck ", tPowercheck.Sub(tDrand),
|
|
||||||
"tTicket ", tTicket.Sub(tPowercheck),
|
"tTicket ", tTicket.Sub(tPowercheck),
|
||||||
"tSeed ", tSeed.Sub(tTicket),
|
"tSeed ", tSeed.Sub(tTicket),
|
||||||
"tProof ", tProof.Sub(tSeed),
|
"tProof ", tProof.Sub(tSeed),
|
||||||
|
Loading…
Reference in New Issue
Block a user