Merge pull request #11241 from filecoin-project/asr/fix-miner-logs

fix: miner: correct duration logs in mineOne
This commit is contained in:
Aayush Rajasekaran 2023-09-06 11:45:10 -04:00 committed by GitHub
commit 4ea712c011
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -562,7 +562,7 @@ func (m *Miner) mineOne(ctx context.Context, base *MiningBase) (minedBlock *type
return nil, err return nil, err
} }
tEquivocateWait := build.Clock.Now() tPending := build.Clock.Now()
// This next block exists to "catch" equivocating miners, // This next block exists to "catch" equivocating miners,
// who submit 2 blocks at the same height at different times in order to split the network. // who submit 2 blocks at the same height at different times in order to split the network.
@ -576,6 +576,8 @@ func (m *Miner) mineOne(ctx context.Context, base *MiningBase) (minedBlock *type
return nil, err return nil, err
} }
tEquivocateWait := build.Clock.Now()
// If the base has changed, we take the _intersection_ of our old base and new base, // If the base has changed, we take the _intersection_ of our old base and new base,
// thus ejecting blocks from any equivocating miners, without taking any new blocks. // thus ejecting blocks from any equivocating miners, without taking any new blocks.
if newBase.TipSet.Height() == base.TipSet.Height() && !newBase.TipSet.Equals(base.TipSet) { if newBase.TipSet.Height() == base.TipSet.Height() && !newBase.TipSet.Equals(base.TipSet) {
@ -621,7 +623,7 @@ func (m *Miner) mineOne(ctx context.Context, base *MiningBase) (minedBlock *type
} }
} }
tPending := build.Clock.Now() tIntersectAndRefresh := build.Clock.Now()
// TODO: winning post proof // TODO: winning post proof
minedBlock, err = m.createBlock(base, m.address, ticket, winner, bvals, postProof, msgs) minedBlock, err = m.createBlock(base, m.address, ticket, winner, bvals, postProof, msgs)
@ -643,9 +645,10 @@ func (m *Miner) mineOne(ctx context.Context, base *MiningBase) (minedBlock *type
"tTicket ", tTicket.Sub(tPowercheck), "tTicket ", tTicket.Sub(tPowercheck),
"tSeed ", tSeed.Sub(tTicket), "tSeed ", tSeed.Sub(tTicket),
"tProof ", tProof.Sub(tSeed), "tProof ", tProof.Sub(tSeed),
"tEquivocateWait ", tEquivocateWait.Sub(tProof), "tPending ", tPending.Sub(tProof),
"tPending ", tPending.Sub(tEquivocateWait), "tEquivocateWait ", tEquivocateWait.Sub(tPending),
"tCreateBlock ", tCreateBlock.Sub(tPending)) "tIntersectAndRefresh ", tIntersectAndRefresh.Sub(tEquivocateWait),
"tCreateBlock ", tCreateBlock.Sub(tIntersectAndRefresh))
} }
return minedBlock, nil return minedBlock, nil