Skip to content

Commit

Permalink
fix mem leak in proposerVotes
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangchiqing committed Oct 22, 2021
1 parent 36efab8 commit 5df7142
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions consensus/hotstuff/voteaggregator/vote_aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ func (va *VoteAggregator) StoreProposerVote(vote *model.Vote) bool {
return false
}
va.proposerVotes[vote.BlockID] = vote
// update viewToBlockIDSet
blockIDSet, exists := va.viewToBlockIDSet[vote.View]
if exists {
blockIDSet[vote.BlockID] = struct{}{}
} else {
blockIDSet = make(map[flow.Identifier]struct{})
blockIDSet[vote.BlockID] = struct{}{}
va.viewToBlockIDSet[vote.View] = blockIDSet
}
return true
}

Expand Down

0 comments on commit 5df7142

Please sign in to comment.