Skip to content

Commit

Permalink
dbft: improve "ignoring"-related debug messages
Browse files Browse the repository at this point in the history
PrepareRequest and PrepareResponse are ignored not only because of view
changing. Wrong log is misleading, so we'd better have the log that reflects
the real state of things.

Signed-off-by: Anna Shaleva <[email protected]>
  • Loading branch information
AnnaShaleva committed Jan 30, 2024
1 parent 8b6cbaa commit 3ff22d5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dbft.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func (d *DBFT) onPrepareRequest(msg payload.ConsensusPayload) {
// ignore prepareRequest if we had already received it or
// are in process of changing view
if d.RequestSentOrReceived() { //|| (d.ViewChanging() && !d.MoreThanFNodesCommittedOrLost()) {
d.Logger.Debug("ignoring PrepareRequest due to view changing",
d.Logger.Debug("ignoring PrepareRequest",
zap.Bool("sor", d.RequestSentOrReceived()),
zap.Bool("viewChanging", d.ViewChanging()),
zap.Bool("moreThanF", d.MoreThanFNodesCommittedOrLost()))
Expand Down Expand Up @@ -422,7 +422,11 @@ func (d *DBFT) onPrepareResponse(msg payload.ConsensusPayload) {
// ignore PrepareResponse if in process of changing view
m := d.PreparationPayloads[msg.ValidatorIndex()]
if m != nil || d.ViewChanging() && !d.MoreThanFNodesCommittedOrLost() {
d.Logger.Debug("ignoring PrepareResponse because of view changing")
d.Logger.Debug("ignoring PrepareResponse",
zap.Bool("dup", m != nil),
zap.Bool("sor", d.RequestSentOrReceived()),
zap.Bool("viewChanging", d.ViewChanging()),
zap.Bool("moreThanF", d.MoreThanFNodesCommittedOrLost()))

Check warning on line 429 in dbft.go

View check run for this annotation

Codecov / codecov/patch

dbft.go#L425-L429

Added lines #L425 - L429 were not covered by tests
return
}

Expand Down

0 comments on commit 3ff22d5

Please sign in to comment.