Skip to content

Commit

Permalink
BP 3156
Browse files Browse the repository at this point in the history
  • Loading branch information
ValarDragon committed Aug 19, 2024
1 parent 601c002 commit 195d6fb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `[consensus]` Make Vote messages only take one peerstate mutex
([\#3156](https://github.com/cometbft/cometbft/issues/3156))
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ It also includes a few other bug fixes and performance improvements.
- `[indexer]` Fixed ineffective select break statements; they now
point to their enclosing for loop label to exit
([\#3544](https://github.com/cometbft/cometbft/issues/3544))
- [#91](https://github.com/osmosis-labs/cometbft/pull/91) perf(consensus): Minor improvement by making add vote only do one peer set mutex call, not 3 (#3156)

## v0.38.10

Expand Down
10 changes: 10 additions & 0 deletions consensus/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1365,6 +1365,16 @@ func (ps *PeerState) SetHasVote(vote *types.Vote) {
ps.setHasVote(vote.Height, vote.Round, vote.Type, vote.ValidatorIndex)
}

// SetHasVote sets the given vote as known by the peer.
func (ps *PeerState) SetHasVoteFromPeer(vote *types.Vote, csHeight int64, valSize, lastCommitSize int) {
ps.mtx.Lock()
defer ps.mtx.Unlock()

ps.ensureVoteBitArrays(csHeight, valSize)
ps.ensureVoteBitArrays(csHeight-1, lastCommitSize)
ps.setHasVote(vote.Height, vote.Round, vote.Type, vote.ValidatorIndex)
}

func (ps *PeerState) setHasVote(height int64, round int32, voteType cmtproto.SignedMsgType, index int32) {
ps.logger.Debug("setHasVote",
"peerH/R",
Expand Down

0 comments on commit 195d6fb

Please sign in to comment.