Explorar o código

build_tx: added cashier vec to State

lunar-mining %!s(int64=4) %!d(string=hai) anos
pai
achega
d97bb6427e
Modificáronse 2 ficheiros con 12 adicións e 0 borrados
  1. 10 0
      src/bin/build_tx.rs
  2. 2 0
      src/client.rs

+ 10 - 0
src/bin/build_tx.rs

@@ -5,6 +5,7 @@ use drk::{
     crypto::{
         load_params, merkle::CommitmentTree, save_params, setup_mint_prover, setup_spend_prover,
     },
+    serial::deserialize,
     state::state_transition,
     tx,
     util::{expand_path, join_config_path},
@@ -27,6 +28,14 @@ async fn main() -> Result<()> {
     let config_cashier: CashierdConfig =
         Config::<CashierdConfig>::load(join_config_path(&PathBuf::from("cashierd.toml"))?)?;
 
+    let mut public_keys = Vec::new();
+
+    for cashier in config.clone().cashiers {
+        let cashier_public: jubjub::SubgroupPoint =
+            deserialize(&bs58::decode(cashier.cashier_public_key).into_vec()?)?;
+        public_keys.push(cashier_public);
+    }
+
     let rocks = Rocks::new(expand_path(&config.database_path.clone())?.as_path())?;
 
     let merkle_roots = RocksColumn::<columns::MerkleRoots>::new(rocks.clone());
@@ -122,6 +131,7 @@ async fn main() -> Result<()> {
         mint_pvk,
         spend_pvk,
         wallet,
+        public_keys,
     }));
 
     //

+ 2 - 0
src/client.rs

@@ -402,7 +402,9 @@ pub struct State {
     pub mint_pvk: groth16::PreparedVerifyingKey<Bls12>,
     // Spend verifying key used by ZK
     pub spend_pvk: groth16::PreparedVerifyingKey<Bls12>,
+    // Pointer to sql database
     pub wallet: WalletPtr,
+    // List of cashier public keys
     pub public_keys: Vec<jubjub::SubgroupPoint>,
 }