Make a trait out of sign::StateMachine for more complex Transaction flows

This commit is contained in:
Luke Parker
2022-04-29 22:36:43 -04:00
parent 27396a6291
commit d0506e2e9b
4 changed files with 82 additions and 58 deletions

View File

@@ -10,7 +10,7 @@ use frost::{
MultisigParams, MultisigKeys,
key_gen,
algorithm::{Algorithm, Schnorr, SchnorrSignature},
sign
sign::{StateMachine, AlgorithmMachine}
};
mod common;
@@ -28,13 +28,11 @@ fn sign<C: Curve, A: Algorithm<C, Signature = SchnorrSignature<C>>>(
commitments.resize(PARTICIPANTS + 1, None);
for i in 1 ..= t {
machines.push(
sign::StateMachine::new(
sign::Params::new(
algorithm.clone(),
keys[i - 1].clone(),
&(1 ..= t).collect::<Vec<usize>>()
).unwrap()
)
AlgorithmMachine::new(
algorithm.clone(),
keys[i - 1].clone(),
&(1 ..= t).collect::<Vec<usize>>()
).unwrap()
);
commitments[i] = Some(machines[i - 1].preprocess(&mut OsRng).unwrap());
}