Explorar o código

drk: Only mark spent coins if necessary.

parazyd %!s(int64=3) %!d(string=hai) anos
pai
achega
ce71169a8a
Modificáronse 1 ficheiros con 5 adicións e 3 borrados
  1. 5 3
      bin/drk/src/rpc_blockchain.rs

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

@@ -212,9 +212,11 @@ impl Drk {
         self.put_tree(&tree).await?;
         eprintln!("Merkle tree written successfully");
 
-        eprintln!("Marking spent coins");
-        self.mark_spent_coins(nullifiers).await?;
-        eprintln!("Spent coins marked successfully");
+        if !nullifiers.is_empty() {
+            eprintln!("Found {} spent coins, marking as spent", nullifiers.len());
+            self.mark_spent_coins(nullifiers).await?;
+            eprintln!("Spent coins marked successfully");
+        }
 
         // This is the SQL query we'll be executing to insert coins into the wallet
         let query = format!(