Skip to content

Commit

Permalink
Narrow a parameter in apply_encrypted_vote_tally
Browse files Browse the repository at this point in the history
The signature proof is verified by the caller, it's misleading to have
it passed into the method only to use the id.
  • Loading branch information
Mikhail Zabaluev committed Mar 2, 2021
1 parent b4c43b7 commit c3c3987
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion chain-impl-mockchain/src/ledger/ledger.rs
Expand Up @@ -1159,7 +1159,7 @@ impl Ledger {

self.votes = self
.votes
.apply_encrypted_vote_tally(self.date(), &stake, tally, sig)?;
.apply_encrypted_vote_tally(self.date(), &stake, tally, sig.id)?;

Ok(self)
}
Expand Down
7 changes: 4 additions & 3 deletions chain-impl-mockchain/src/vote/ledger.rs
@@ -1,4 +1,4 @@
use crate::certificate::{EncryptedVoteTally, EncryptedVoteTallyProof};
use crate::certificate::EncryptedVoteTally;
use crate::{
certificate::{TallyProof, VoteAction, VoteCast, VotePlan, VotePlanId, VoteTally},
date::BlockDate,
Expand Down Expand Up @@ -185,12 +185,13 @@ impl VotePlanLedger {
block_date: BlockDate,
stake: &StakeControl,
encrypted_tally: &EncryptedVoteTally,
sig: EncryptedVoteTallyProof,
committee_id: CommitteeId,
) -> Result<Self, VotePlanLedgerError> {
let id = encrypted_tally.id().clone();

let r = self.plans.update(&id, move |v| {
v.start_private_tally(block_date, stake, sig.id).map(Some)
v.start_private_tally(block_date, stake, committee_id)
.map(Some)
});

match r {
Expand Down

0 comments on commit c3c3987

Please sign in to comment.