|
@@ -194,7 +194,7 @@ impl Wallet {
|
|
for (mint, _) in mints {
|
|
for (mint, _) in mints {
|
|
if let Some(proofs) = self
|
|
if let Some(proofs) = self
|
|
.localstore
|
|
.localstore
|
|
- .get_proofs(Some(mint.clone()), None, None, None)
|
|
|
|
|
|
+ .get_proofs(Some(mint.clone()), None, Some(vec![State::Unspent]), None)
|
|
.await?
|
|
.await?
|
|
{
|
|
{
|
|
let mut balances = HashMap::new();
|
|
let mut balances = HashMap::new();
|
|
@@ -440,7 +440,7 @@ impl Wallet {
|
|
unit: unit.clone(),
|
|
unit: unit.clone(),
|
|
request: quote_res.request,
|
|
request: quote_res.request,
|
|
paid: quote_res.paid,
|
|
paid: quote_res.paid,
|
|
- expiry: quote_res.expiry,
|
|
|
|
|
|
+ expiry: quote_res.expiry.unwrap_or(0),
|
|
};
|
|
};
|
|
|
|
|
|
self.localstore.add_mint_quote(quote.clone()).await?;
|
|
self.localstore.add_mint_quote(quote.clone()).await?;
|
|
@@ -693,6 +693,7 @@ impl Wallet {
|
|
|
|
|
|
let active_keyset_id = self.active_mint_keyset(mint_url, unit).await?;
|
|
let active_keyset_id = self.active_mint_keyset(mint_url, unit).await?;
|
|
|
|
|
|
|
|
+ // FIXME: Should not increment keyset counter for condition proofs
|
|
self.localstore
|
|
self.localstore
|
|
.increment_keyset_counter(&active_keyset_id, post_swap_proofs.len() as u32)
|
|
.increment_keyset_counter(&active_keyset_id, post_swap_proofs.len() as u32)
|
|
.await?;
|
|
.await?;
|
|
@@ -752,8 +753,6 @@ impl Wallet {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- self.localstore.remove_proofs(&input_proofs).await?;
|
|
|
|
-
|
|
|
|
for proof in input_proofs {
|
|
for proof in input_proofs {
|
|
self.localstore
|
|
self.localstore
|
|
.set_proof_state(proof.y()?, State::Reserved)
|
|
.set_proof_state(proof.y()?, State::Reserved)
|
|
@@ -849,7 +848,7 @@ impl Wallet {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
- // Combine the BlindedMessages totoalling the desired amount with change
|
|
|
|
|
|
+ // Combine the BlindedMessages totaling the desired amount with change
|
|
desired_messages.combine(change_messages);
|
|
desired_messages.combine(change_messages);
|
|
// Sort the premint secrets to avoid finger printing
|
|
// Sort the premint secrets to avoid finger printing
|
|
desired_messages.sort_secrets();
|
|
desired_messages.sort_secrets();
|
|
@@ -926,13 +925,15 @@ impl Wallet {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ let send_proofs = send_proofs.ok_or(Error::InsufficientFunds)?;
|
|
|
|
+ for proof in send_proofs.iter() {
|
|
|
|
+ self.localstore
|
|
|
|
+ .set_proof_state(proof.y()?, State::Reserved)
|
|
|
|
+ .await?;
|
|
|
|
+ }
|
|
|
|
+
|
|
Ok(self
|
|
Ok(self
|
|
- .proof_to_token(
|
|
|
|
- mint_url.clone(),
|
|
|
|
- send_proofs.ok_or(Error::InsufficientFunds)?,
|
|
|
|
- memo,
|
|
|
|
- Some(unit.clone()),
|
|
|
|
- )?
|
|
|
|
|
|
+ .proof_to_token(mint_url.clone(), send_proofs, memo, Some(unit.clone()))?
|
|
.to_string())
|
|
.to_string())
|
|
}
|
|
}
|
|
|
|
|