1. Add a new struct called VoteAccumulator to a separate module, src/vote_accumulator.rs:
2. Define an enum that will hold the voting result:
3. Implement public API for VoteAccumulator:
The implementation logic for the methods should be the following:
3.1. We’ll keep adding votes for a given block to the accumulator. Once the block becomes valid it is returned to be added to the chain. If the block is already valid and the vote is valid, then the vote corresponding proof is returned to be added to the chain.
3.2. -Blocks are held until there are G + (G - Q) (because some who are no longer supposed to vote (e.g. a demoted elder) haven’t yet realised so they vote too) votes and can then be silently dropped.- Each block is held there for a set length of time. If at timeout the block has < G votes, it is returned so that non-voters can be identified. If at timeout the block has >= G votes then it can be silently dropped.
3.3. When anything apart from a live block becomes valid the accumulator should remove all votes from that node.