Skip to content

Commit

Permalink
Merge pull request #135 from nspcc-dev/fix-recovery-sending
Browse files Browse the repository at this point in the history
dbft: prohibit WatchOnly to send RecoveryMessage
  • Loading branch information
roman-khimov authored Nov 28, 2024
2 parents 82ad778 + 0e51420 commit 94bc382
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Bugs fixed:
* PreHeader is constructed instead of PreBlock to create PreCommit message (#128)
* enable anti-MEV extension with respect to the current block index (#132)
* (*Context).PreBlock() method returns PreHeader instead of PreBlock (#133)
* WatchOnly node may send RecoveryMessage on RecoveryRequest (#135)

## [0.3.0] (01 August 2024)

Expand Down
5 changes: 5 additions & 0 deletions dbft.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,11 @@ func (d *DBFT[H]) onCommit(msg ConsensusPayload[H]) {
}

func (d *DBFT[H]) onRecoveryRequest(msg ConsensusPayload[H]) {
// Only validators are allowed to send consensus messages.
if d.Context.WatchOnly() {
return
}

if !d.CommitSent() && (!d.isAntiMEVExtensionEnabled() || !d.PreCommitSent()) {
// Ignore the message if our index is not in F+1 range of the
// next (%N) ones from the sender. This limits recovery
Expand Down

0 comments on commit 94bc382

Please sign in to comment.