|
|
@@ -1546,14 +1546,7 @@ impl MultiMintWallet {
|
|
|
|
|
|
// Spawn parallel tasks to get quotes from each mint
|
|
|
for (mint_url, amount) in mint_amounts {
|
|
|
- let wallets = self.wallets.read().await;
|
|
|
- let wallet = wallets
|
|
|
- .get(&mint_url)
|
|
|
- .ok_or(Error::UnknownMint {
|
|
|
- mint_url: mint_url.to_string(),
|
|
|
- })?
|
|
|
- .clone();
|
|
|
- drop(wallets);
|
|
|
+ let wallets = self.wallets.clone();
|
|
|
|
|
|
let bolt11_clone = bolt11.clone();
|
|
|
let mint_url_clone = mint_url.clone();
|
|
|
@@ -1563,6 +1556,14 @@ impl MultiMintWallet {
|
|
|
let options = Some(MeltOptions::new_mpp(amount_msat));
|
|
|
|
|
|
let task = spawn(async move {
|
|
|
+ let wallets = wallets.read().await;
|
|
|
+ let wallet = wallets
|
|
|
+ .get(&mint_url)
|
|
|
+ .ok_or(Error::UnknownMint {
|
|
|
+ mint_url: mint_url.to_string(),
|
|
|
+ })?
|
|
|
+ .clone();
|
|
|
+ drop(wallets);
|
|
|
let quote = wallet.melt_quote(bolt11_clone, options).await;
|
|
|
(mint_url_clone, quote)
|
|
|
});
|
|
|
@@ -1600,18 +1601,17 @@ impl MultiMintWallet {
|
|
|
let mut tasks = Vec::new();
|
|
|
|
|
|
for (mint_url, quote_id) in quotes {
|
|
|
- let wallets = self.wallets.read().await;
|
|
|
- let wallet = wallets
|
|
|
- .get(&mint_url)
|
|
|
- .ok_or(Error::UnknownMint {
|
|
|
- mint_url: mint_url.to_string(),
|
|
|
- })?
|
|
|
- .clone();
|
|
|
- drop(wallets);
|
|
|
-
|
|
|
let mint_url_clone = mint_url.clone();
|
|
|
+ let wallets = self.wallets.clone();
|
|
|
|
|
|
let task = spawn(async move {
|
|
|
+ let wallets = wallets.read().await;
|
|
|
+ let wallet = wallets
|
|
|
+ .get(&mint_url)
|
|
|
+ .ok_or(Error::UnknownMint {
|
|
|
+ mint_url: mint_url.to_string(),
|
|
|
+ })
|
|
|
+ .expect("xxx");
|
|
|
let melted = wallet.melt("e_id).await;
|
|
|
(mint_url_clone, melted)
|
|
|
});
|