CodeChain-io/codechain

Make StepCollector idempotent

foriequal0 opened this issue · 1 comments

StepCollector erroneously reports two same messages in a row as a double vote.

VoteCollector::vote(ConsensusMessage { height: 123, view: 0, block: "0xabcd" }) => Ok
VoteCollector::vote(ConsensusMessage { height: 123, view: 0, block: "0xabcd" }) => DoubleVote

However this might be a valid in some cases.

It was idempotent already. I misunderstood it.

I changed it to return Result<(), DoubleVote> instead of Option<DoubleVote>
https://github.com/CodeChain-io/codechain/pull/1800/files