Skip to content

Commit

Permalink
dbft: do not send PrepareRequest immediately after Recovery message
Browse files Browse the repository at this point in the history
We have timer, and we should follow it. Close #74.

Signed-off-by: Anna Shaleva <anna@nspcc.ru>
  • Loading branch information
AnnaShaleva committed Apr 21, 2023
1 parent 0108387 commit 945de8e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dbft.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ func (d *DBFT) start() {
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()) {
if d.RequestSentOrReceived() {// || (d.ViewChanging() && !d.MoreThanFNodesCommittedOrLost()) {
d.Logger.Debug("ignoring PrepareRequest due to view changing",
zap.Bool("sor", d.RequestSentOrReceived()),
zap.Bool("viewChanging", d.ViewChanging()),
Expand Down Expand Up @@ -593,9 +593,9 @@ func (d *DBFT) onRecoveryMessage(msg payload.ConsensusPayload) {
if prepReq != nil {
totalPrepReq, validPrepReq = 1, 1
d.OnReceive(prepReq)
} else if d.IsPrimary() {
d.sendPrepareRequest()
}
// If the node is primary, then wait until timer fires to send PrepareRequest
// to avoid rush in blocks submission, #74.
}

for _, m := range recovery.GetPrepareResponses(msg, d.Validators) {
Expand Down

0 comments on commit 945de8e

Please sign in to comment.