Skip to content

Commit

Permalink
protocols/ronin, vote/votepool: improve vote channel queue (#336)
Browse files Browse the repository at this point in the history
* protocols/ronin: remove redudant finality vote channel put

* vote/vote_pool: make PutVote non-blocking, drop vote in case of failure
  • Loading branch information
minh-bq committed Sep 7, 2023
1 parent 368fe23 commit e2e7ed3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion core/vote/vote_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ func (pool *VotePool) loop() {
}

func (pool *VotePool) PutVote(peer string, vote *types.VoteEnvelope) {
pool.votesCh <- &voteWithPeer{vote: vote, peer: peer}
select {
case pool.votesCh <- &voteWithPeer{vote: vote, peer: peer}:
default:
log.Debug("Failed to put vote into vote pool")
}
}

func (pool *VotePool) putIntoVotePool(voteWithPeerInfo *voteWithPeer) bool {
Expand Down
1 change: 0 additions & 1 deletion eth/protocols/ronin/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ func (p *Peer) AsyncSendNewVote(vote *types.VoteEnvelope) {
default:
p.Log().Debug("Dropping vote announcement", "hash", vote.Hash())
}
p.voteCh <- vote
}

// batchVote batches multiple votes and sends to the peer.
Expand Down

0 comments on commit e2e7ed3

Please sign in to comment.