Skip to content

Commit

Permalink
dbft: improve "ignoring"-related error messages
Browse files Browse the repository at this point in the history
PrepareRequest and PrepareResponse are ignored not only because of vuew
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 5114a9d
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()))
return
}

Expand Down

0 comments on commit 5114a9d

Please sign in to comment.