Skip to content

Commit

Permalink
improve getBlockByMaxVote
Browse files Browse the repository at this point in the history
  • Loading branch information
GheisMohammadi committed Oct 4, 2024
1 parent a58f88d commit 2bea886
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/service/stagedstreamsync/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ func getBlockByMaxVote(blocks []*types.Block) (*types.Block, error) {
if block == nil {
continue
}
if _, exist := hashesVote[block.Header().Hash()]; !exist {
hashesVote[block.Header().Hash()] = 0
}
hashesVote[block.Header().Hash()]++
if hashesVote[block.Header().Hash()] > maxVote {
maxVote = hashesVote[block.Header().Hash()]
Expand Down

0 comments on commit 2bea886

Please sign in to comment.