Skip to content

Commit

Permalink
initial builder for vote_tally
Browse files Browse the repository at this point in the history
  • Loading branch information
dkijania committed Sep 21, 2020
1 parent 071f119 commit 70a9258
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion chain-impl-mockchain/src/testing/builders/initial_builder.rs
@@ -1,5 +1,5 @@
use crate::{
certificate::{Certificate, PoolUpdate, VoteCast, VotePlan},
certificate::{Certificate, PoolUpdate, VoteCast, VotePlan, VoteTally},
fragment::Fragment,
key::EitherEd25519SecretKey,
ledger::ledger::OutputAddress,
Expand Down Expand Up @@ -59,6 +59,16 @@ pub fn create_initial_vote_cast(vote_cast: &VoteCast, owners: &[Wallet]) -> Frag
fragment(cert, keys, &[], &[])
}

pub fn create_initial_vote_tally(vote_tally: &VoteTally, owners: &[Wallet]) -> Fragment {
let cert: Certificate = vote_tally.clone().into();
let keys: Vec<EitherEd25519SecretKey> = owners
.iter()
.cloned()
.map(|owner| owner.private_key())
.collect();
fragment(cert, keys, &[], &[])
}

pub fn create_initial_transaction(wallet: &Wallet) -> Fragment {
let tx = TxBuilder::new()
.set_nopayload()
Expand Down

0 comments on commit 70a9258

Please sign in to comment.