Procházet zdrojové kódy

drk: Reset DAO parts of the wallet when initiating a chain rescan.

parazyd před 3 roky
rodič
revize
333a73643b
1 změnil soubory, kde provedl 5 přidání a 2 odebrání
  1. 5 2
      bin/drk/src/rpc_blockchain.rs

+ 5 - 2
bin/drk/src/rpc_blockchain.rs

@@ -115,7 +115,7 @@ impl Drk {
     /// to us. If any are found, the metadata is extracted and placed into the wallet
     /// to us. If any are found, the metadata is extracted and placed into the wallet
     /// for future use.
     /// for future use.
     async fn scan_block_dao(&self, block: &BlockInfo) -> Result<()> {
     async fn scan_block_dao(&self, block: &BlockInfo) -> Result<()> {
-        eprintln!("Iterating over {} transactions", block.txs.len());
+        eprintln!("[DAO] Iterating over {} transactions", block.txs.len());
         for tx in block.txs.iter() {
         for tx in block.txs.iter() {
             self.apply_tx_dao_data(tx, true).await?;
             self.apply_tx_dao_data(tx, true).await?;
         }
         }
@@ -128,7 +128,7 @@ impl Drk {
     /// to us. If any are found, the metadata is extracted and placed into the wallet
     /// to us. If any are found, the metadata is extracted and placed into the wallet
     /// for future use.
     /// for future use.
     async fn scan_block_money(&self, block: &BlockInfo) -> Result<()> {
     async fn scan_block_money(&self, block: &BlockInfo) -> Result<()> {
-        eprintln!("Iterating over {} transactions", block.txs.len());
+        eprintln!("[Money] Iterating over {} transactions", block.txs.len());
 
 
         for tx in block.txs.iter() {
         for tx in block.txs.iter() {
             self.apply_tx_money_data(tx, true).await?;
             self.apply_tx_money_data(tx, true).await?;
@@ -203,6 +203,9 @@ impl Drk {
     pub async fn scan_blocks(&self, reset: bool) -> Result<()> {
     pub async fn scan_blocks(&self, reset: bool) -> Result<()> {
         let mut sl = if reset {
         let mut sl = if reset {
             self.reset_money_tree().await?;
             self.reset_money_tree().await?;
+            self.reset_money_coins().await?;
+            self.reset_dao_trees().await?;
+            self.reset_daos().await?;
             0
             0
         } else {
         } else {
             self.last_scanned_slot().await?
             self.last_scanned_slot().await?