fix: wallet panic

This commit is contained in:
trisua 2025-08-08 14:52:53 -04:00
parent e5e6d5cddb
commit a08552338b
4 changed files with 46 additions and 13 deletions

View file

@ -58,7 +58,7 @@ impl DataManager {
Ok(res.unwrap())
}
const MAXIMUM_FREE_PRODUCTS: usize = 5;
const MAXIMUM_FREE_PRODUCTS: usize = 10;
/// Create a new product in the database.
///

View file

@ -54,13 +54,17 @@ impl DataManager {
match transfer.method {
CoinTransferMethod::Transfer => None,
CoinTransferMethod::Purchase(id) => {
Some(if let Some(product) = seen_products.get(&id) {
product.to_owned()
if let Some(product) = seen_products.get(&id) {
Some(product.to_owned())
} else {
let product = self.get_product_by_id(id).await?;
seen_products.insert(product.id, product.clone());
product
})
match self.get_product_by_id(id).await {
Ok(product) => {
seen_products.insert(product.id, product.clone());
Some(product)
}
Err(_) => None,
}
}
}
},
transfer.is_pending,