Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't fetch metadata for announced mints #1195

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions mutiny-core/src/nostr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use bitcoin::{hashes::hex::FromHex, secp256k1::ThirtyTwoByteHash, Network};
use fedimint_core::api::InviteCode;
use fedimint_core::config::{ClientConfig, FederationId};
use futures::{pin_mut, select, FutureExt};
use futures_util::future::join_all;
use futures_util::lock::Mutex;
use lightning::util::logger::Logger;
use lightning::{log_debug, log_error, log_info, log_warn};
Expand Down Expand Up @@ -2292,19 +2291,20 @@ impl<S: MutinyStorage, P: PrimalApi, C: NostrClient> NostrManager<S, P, C> {
mints.sort();

// try to get federation info from client config if not in event
let futures = mints
.iter_mut()
.map(|mint| mint.try_fetch_metadata())
.collect::<Vec<_>>();
join_all(futures).await;
// todo this currently retries which takes forever with bad mints, need to wait for next release of fedimint
// let futures = mints
// .iter_mut()
// .map(|mint| mint.try_fetch_metadata())
// .collect::<Vec<_>>();
// join_all(futures).await;

// remove mints that expire within the 30 days and ones we couldn't fetch metadata for
let days_30_from_now = utils::now() + Duration::from_secs(86_400 * 30);
mints.retain(|m| {
m.metadata.is_some()
&& (m.expire_timestamp.is_none()
|| m.expire_timestamp.unwrap() > days_30_from_now.as_secs())
});
// let days_30_from_now = utils::now() + Duration::from_secs(86_400 * 30);
// mints.retain(|m| {
// m.metadata.is_some()
// && (m.expire_timestamp.is_none()
// || m.expire_timestamp.unwrap() > days_30_from_now.as_secs())
// });

Ok(mints)
}
Expand Down
Loading