فهرست منبع

pass wallet adapter instead of walletdb

rachel-rose 5 سال پیش
والد
کامیت
028bbe1dce
2فایلهای تغییر یافته به همراه2 افزوده شده و 8 حذف شده
  1. 1 7
      src/bin/darkfid.rs
  2. 1 1
      src/rpc/adapter.rs

+ 1 - 7
src/bin/darkfid.rs

@@ -39,16 +39,13 @@ pub struct State {
     // Nullifiers prevent double spending
     // Nullifiers prevent double spending
     nullifiers: RocksColumn<columns::Nullifiers>,
     nullifiers: RocksColumn<columns::Nullifiers>,
     // All received coins
     // All received coins
-    //own_coins: Vec<(Coin, Note, jubjub::Fr, IncrementalWitness<MerkleNode>)>,
     // Mint verifying key used by ZK
     // Mint verifying key used by ZK
     mint_pvk: groth16::PreparedVerifyingKey<Bls12>,
     mint_pvk: groth16::PreparedVerifyingKey<Bls12>,
     // Spend verifying key used by ZK
     // Spend verifying key used by ZK
     spend_pvk: groth16::PreparedVerifyingKey<Bls12>,
     spend_pvk: groth16::PreparedVerifyingKey<Bls12>,
     // Public key of the cashier
     // Public key of the cashier
-    //cashier_public: jubjub::SubgroupPoint,
     // List of all our secret keys
     // List of all our secret keys
     wallet: WalletDB,
     wallet: WalletDB,
-    //secrets: Vec<jubjub::Fr>,
 }
 }
 
 
 impl ProgramState for State {
 impl ProgramState for State {
@@ -194,18 +191,15 @@ async fn start(executor: Arc<Executor<'_>>, options: ClientProgramOptions) -> Re
 
 
     let merkle_roots = RocksColumn::<columns::MerkleRoots>::new(rocks.clone());
     let merkle_roots = RocksColumn::<columns::MerkleRoots>::new(rocks.clone());
     let nullifiers = RocksColumn::<columns::Nullifiers>::new(rocks);
     let nullifiers = RocksColumn::<columns::Nullifiers>::new(rocks);
-    let wallet = WalletDB::new("wallet.db")?;
+    let wallet = RpcAdapter::new("wallet.db")?.wallet;
 
 
     let state = State {
     let state = State {
         tree: CommitmentTree::empty(),
         tree: CommitmentTree::empty(),
         merkle_roots,
         merkle_roots,
         nullifiers,
         nullifiers,
-        //own_coins: vec![],
         mint_pvk,
         mint_pvk,
         spend_pvk,
         spend_pvk,
         wallet,
         wallet,
-        //cashier_public,
-        //secrets: vec![secret.clone()],
     };
     };
 
 
     // create gateway client
     // create gateway client

+ 1 - 1
src/rpc/adapter.rs

@@ -6,7 +6,7 @@ use log::*;
 // there should
 // there should
 // Dummy adapter for now
 // Dummy adapter for now
 pub struct RpcAdapter {
 pub struct RpcAdapter {
-    wallet: WalletDB,
+    pub wallet: WalletDB,
 }
 }
 
 
 impl RpcAdapter {
 impl RpcAdapter {