some useful log messages

This commit is contained in:
whyrusleeping 2019-12-02 16:08:08 -08:00
parent f4c082c7de
commit 4500a36ec6
2 changed files with 18 additions and 2 deletions

View File

@ -283,6 +283,9 @@ func (m *Miner) mineOne(ctx context.Context, addr address.Address, base *MiningB
dur := time.Now().Sub(start)
log.Infof("Creating block took %s", dur)
if dur > time.Second*build.BlockDelay {
log.Warn("CAUTION: block production took longer than the block delay. Your computer may not be fast enough to keep up")
}
return b, nil
}

View File

@ -4,6 +4,7 @@ import (
"context"
"errors"
"sync"
"time"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
@ -154,11 +155,17 @@ func NewElectionPoStProver(sb *sectorbuilder.SectorBuilder) *SectorBuilderEpp {
var _ gen.ElectionPoStProver = (*SectorBuilderEpp)(nil)
func (epp *SectorBuilderEpp) GenerateCandidates(ctx context.Context, ssi sectorbuilder.SortedPublicSectorInfo, rand []byte) ([]sectorbuilder.EPostCandidate, error) {
start := time.Now()
var faults []uint64 // TODO
var randbuf [32]byte
copy(randbuf[:], rand)
return epp.sb.GenerateEPostCandidates(ssi, randbuf, faults)
cds, err := epp.sb.GenerateEPostCandidates(ssi, randbuf, faults)
if err != nil {
return nil, err
}
log.Infof("Generate candidates took %s", time.Since(start))
return cds, nil
}
func (epp *SectorBuilderEpp) ComputeProof(ctx context.Context, ssi sectorbuilder.SortedPublicSectorInfo, rand []byte, winners []sectorbuilder.EPostCandidate) ([]byte, error) {
@ -166,5 +173,11 @@ func (epp *SectorBuilderEpp) ComputeProof(ctx context.Context, ssi sectorbuilder
log.Warn("Generating fake EPost proof! You should only see this while running tests!")
return []byte("valid proof"), nil
}
return epp.sb.ComputeElectionPoSt(ssi, rand, winners)
start := time.Now()
proof, err := epp.sb.ComputeElectionPoSt(ssi, rand, winners)
if err != nil {
return nil, err
}
log.Infof("ComputeElectionPost took %s", time.Since(start))
return proof, nil
}