Skip to content
Snippets Groups Projects
Unverified Commit 14fce79a authored by Angelo Capossele's avatar Angelo Capossele Committed by GitHub
Browse files

Update FPC-FCOB log verbosity (#539)

parent 6d399a65
No related branches found
No related tags found
No related merge requests found
......@@ -111,18 +111,21 @@ func configure(_ *node.Plugin) {
FCOB = consensus.NewFCOB(Tangle, time.Duration(cfgAvgNetworkDelay)*time.Second)
FCOB.Events.Vote.Attach(events.NewClosure(func(id string, initOpn vote.Opinion) {
if err := voter.Vote(id, initOpn); err != nil {
log.Error(err)
log.Warnf("FPC vote: %s", err)
}
}))
FCOB.Events.Error.Attach(events.NewClosure(func(err error) {
log.Error(err)
log.Errorf("FCOB error: %s", err)
}))
// configure FPC + link to consensus
configureFPC()
voter.Events().Finalized.Attach(events.NewClosure(FCOB.ProcessVoteResult))
voter.Events().Finalized.Attach(events.NewClosure(func(ev *vote.OpinionEvent) {
log.Infof("FPC finalized for transaction with id '%s' - final opinion: '%s'", ev.ID, ev.Opinion)
}))
voter.Events().Failed.Attach(events.NewClosure(func(ev *vote.OpinionEvent) {
log.Errorf("FPC failed for transaction with id '%s' - last opinion: '%s'", ev.ID, ev.Opinion)
log.Warnf("FPC failed for transaction with id '%s' - last opinion: '%s'", ev.ID, ev.Opinion)
}))
// register SignatureFilter in Parser
......
......@@ -96,7 +96,7 @@ func configureFPC() {
Voter().Events().RoundExecuted.Attach(events.NewClosure(func(roundStats *vote.RoundStats) {
peersQueried := len(roundStats.QueriedOpinions)
voteContextsCount := len(roundStats.ActiveVoteContexts)
log.Infof("executed round with rand %0.4f for %d vote contexts on %d peers, took %v", roundStats.RandUsed, voteContextsCount, peersQueried, roundStats.Duration)
log.Debugf("executed round with rand %0.4f for %d vote contexts on %d peers, took %v", roundStats.RandUsed, voteContextsCount, peersQueried, roundStats.Duration)
}))
}
......@@ -163,7 +163,7 @@ func runFPC() {
select {
case r := <-unixTsPRNG.C():
if err := voter.Round(r); err != nil {
log.Errorf("unable to execute FPC round: %s", err)
log.Warnf("unable to execute FPC round: %s", err)
}
case <-shutdownSignal:
break exit
......
......@@ -40,6 +40,16 @@ const (
Unknown Opinion = 1 << 2
)
func (o Opinion) String() string {
switch {
case o == Like:
return "Like"
case o == Dislike:
return "Dislike"
}
return "Unknown"
}
// ConvertInt32Opinion converts the given int32 to an Opinion.
func ConvertInt32Opinion(x int32) Opinion {
switch {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment