parazyd 4 лет назад
Родитель
Сommit
6e6485d864
2 измененных файлов с 3 добавлено и 9 удалено
  1. 1 4
      src/node/client.rs
  2. 2 5
      src/node/state.rs

+ 1 - 4
src/node/client.rs

@@ -12,7 +12,6 @@ use crate::{
         keypair::{Keypair, PublicKey},
         keypair::{Keypair, PublicKey},
         merkle_node::MerkleNode,
         merkle_node::MerkleNode,
         proof::ProvingKey,
         proof::ProvingKey,
-        token_list::DrkTokenList,
         types::DrkTokenId,
         types::DrkTokenId,
         OwnCoin,
         OwnCoin,
     },
     },
@@ -34,13 +33,12 @@ use crate::{
 pub struct Client {
 pub struct Client {
     pub main_keypair: Mutex<Keypair>,
     pub main_keypair: Mutex<Keypair>,
     pub wallet: WalletPtr,
     pub wallet: WalletPtr,
-    pub tokenlist: Arc<DrkTokenList>,
     mint_pk: Lazy<ProvingKey>,
     mint_pk: Lazy<ProvingKey>,
     burn_pk: Lazy<ProvingKey>,
     burn_pk: Lazy<ProvingKey>,
 }
 }
 
 
 impl Client {
 impl Client {
-    pub async fn new(wallet: WalletPtr, tokenlist: Arc<DrkTokenList>) -> Result<Self> {
+    pub async fn new(wallet: WalletPtr) -> Result<Self> {
         // Initialize or load the wallet
         // Initialize or load the wallet
         wallet.init_db().await?;
         wallet.init_db().await?;
 
 
@@ -57,7 +55,6 @@ impl Client {
         Ok(Self {
         Ok(Self {
             main_keypair: Mutex::new(main_keypair),
             main_keypair: Mutex::new(main_keypair),
             wallet,
             wallet,
-            tokenlist,
             mint_pk: Lazy::new(),
             mint_pk: Lazy::new(),
             burn_pk: Lazy::new(),
             burn_pk: Lazy::new(),
         })
         })

+ 2 - 5
src/node/state.rs

@@ -1,4 +1,3 @@
-use async_std::sync::Arc;
 use incrementalmerkletree::{bridgetree::BridgeTree, Tree};
 use incrementalmerkletree::{bridgetree::BridgeTree, Tree};
 use lazy_init::Lazy;
 use lazy_init::Lazy;
 use log::{debug, error};
 use log::{debug, error};
@@ -13,7 +12,6 @@ use crate::{
         note::{EncryptedNote, Note},
         note::{EncryptedNote, Note},
         nullifier::Nullifier,
         nullifier::Nullifier,
         proof::VerifyingKey,
         proof::VerifyingKey,
-        token_list::DrkTokenList,
         OwnCoin,
         OwnCoin,
     },
     },
     tx::Transaction,
     tx::Transaction,
@@ -142,7 +140,6 @@ impl State {
         secret_keys: Vec<SecretKey>,
         secret_keys: Vec<SecretKey>,
         notify: Option<async_channel::Sender<(PublicKey, u64)>>,
         notify: Option<async_channel::Sender<(PublicKey, u64)>>,
         wallet: WalletPtr,
         wallet: WalletPtr,
-        tokenlist: Arc<DrkTokenList>,
     ) -> Result<()> {
     ) -> Result<()> {
         debug!(target: "state_apply", "Extend nullifier set");
         debug!(target: "state_apply", "Extend nullifier set");
         debug!("Existing nullifiers: {:#?}", self.nullifiers.get_all()?);
         debug!("Existing nullifiers: {:#?}", self.nullifiers.get_all()?);
@@ -170,12 +167,12 @@ impl State {
                     let own_coin =
                     let own_coin =
                         OwnCoin { coin, note, secret: *secret, nullifier, leaf_position };
                         OwnCoin { coin, note, secret: *secret, nullifier, leaf_position };
 
 
-                    // FIXME: BUG check values inside the note are correct
+                    // TODO: FIXME: BUG check values inside the note are correct
                     // We need to hash them all and check them against the coin
                     // We need to hash them all and check them against the coin
                     // for them to be accepted.
                     // for them to be accepted.
                     // Don't trust - verify.
                     // Don't trust - verify.
 
 
-                    wallet.put_own_coin(own_coin, tokenlist.clone()).await?;
+                    wallet.put_own_coin(own_coin).await?;
 
 
                     if let Some(ch) = notify.clone() {
                     if let Some(ch) = notify.clone() {
                         debug!(target: "state_apply", "Send a notification");
                         debug!(target: "state_apply", "Send a notification");