Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit 2f8abbb

Browse files
committed
fix: clippy
1 parent 3d234f2 commit 2f8abbb

File tree

3 files changed

+28
-18
lines changed

3 files changed

+28
-18
lines changed

mutiny-core/src/federation.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -603,25 +603,24 @@ impl<S: MutinyStorage> FederationClient<S> {
603603
}
604604
}
605605

606-
pub(crate) async fn reissue(&self, oob_notes: OOBNotes) -> Result<bool, MutinyError> {
606+
pub(crate) async fn reissue(&self, oob_notes: OOBNotes) -> Result<(), MutinyError> {
607607
let logger = Arc::clone(&self.logger);
608608

609609
// Get the `MintClientModule`
610610
let mint_module = self.fedimint_client.get_first_module::<MintClientModule>();
611611

612-
// TODO: (@leonardo) Do we need any `extra_meta` ?
613612
// Reissue `OOBNotes`
614613
let operation_id = mint_module.reissue_external_notes(oob_notes, ()).await?;
615614

616615
// TODO: (@leonardo) re-think about the results and errors that we need/want
617616
match process_reissue_outcome(&mint_module, operation_id, logger.clone()).await? {
618617
ReissueExternalNotesState::Created | ReissueExternalNotesState::Failed(_) => {
619-
log_info!(logger, "re-issuance of OOBNotes failed!");
618+
log_trace!(logger, "re-issuance of OOBNotes failed!");
620619
Err(MutinyError::FedimintReissueFailed)
621620
}
622621
_ => {
623-
log_info!(logger, "re-issuance of OOBNotes was successful!");
624-
Ok(true)
622+
log_trace!(logger, "re-issuance of OOBNotes was successful!");
623+
Ok(())
625624
}
626625
}
627626
}
@@ -892,12 +891,12 @@ async fn process_reissue_outcome(
892891
let stream_or_outcome = mint_module
893892
.subscribe_reissue_external_notes(operation_id)
894893
.await
895-
.map_err(|e| MutinyError::Other(e))?;
894+
.map_err(MutinyError::Other)?;
896895

897896
match stream_or_outcome {
898897
UpdateStreamOrOutcome::Outcome(outcome) => {
899898
log_trace!(logger, "outcome received {:?}", outcome);
900-
return Ok(outcome);
899+
Ok(outcome)
901900
}
902901
UpdateStreamOrOutcome::UpdateStream(mut stream) => {
903902
let timeout = DEFAULT_REISSUE_TIMEOUT * 1_000;
@@ -925,7 +924,7 @@ async fn process_reissue_outcome(
925924
}
926925
};
927926
}
928-
return Err(MutinyError::FedimintReissueFailed);
927+
Err(MutinyError::FedimintReissueFailed)
929928
}
930929
}
931930
}

mutiny-core/src/lib.rs

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ use crate::utils::parse_profile_metadata;
112112
use mockall::{automock, predicate::*};
113113

114114
const DEFAULT_PAYMENT_TIMEOUT: u64 = 30;
115-
const DEFAULT_REISSUE_TIMEOUT: u64 = 60;
115+
const DEFAULT_REISSUE_TIMEOUT: u64 = 5;
116116
const MAX_FEDERATION_INVOICE_AMT: u64 = 200_000;
117117
const SWAP_LABEL: &str = "SWAP";
118118

@@ -1353,7 +1353,7 @@ impl<S: MutinyStorage> MutinyWallet<S> {
13531353
})
13541354
}
13551355

1356-
pub async fn reissue_oob_notes(&self, oob_notes: OOBNotes) -> Result<bool, MutinyError> {
1356+
pub async fn reissue_oob_notes(&self, oob_notes: OOBNotes) -> Result<(), MutinyError> {
13571357
let federation_lock = self.federations.read().await;
13581358
let federation_ids = self.list_federation_ids().await?;
13591359

@@ -1362,14 +1362,25 @@ impl<S: MutinyStorage> MutinyWallet<S> {
13621362
.find(|id| id.to_prefix() == oob_notes.federation_id_prefix());
13631363

13641364
if let Some(fed_id) = maybe_federation_id {
1365-
log_info!(self.logger, "found federation_id {:?}", fed_id);
1366-
let fedimint_client = federation_lock.get(&fed_id).ok_or(MutinyError::NotFound)?;
1367-
log_info!(self.logger, "got fedimint client for federation_id {:?}", fed_id);
1368-
let reissue = fedimint_client.reissue(oob_notes).await?;
1369-
log_info!(self.logger, "successfully reissued for federation_id {:?}", fed_id);
1370-
Ok(reissue)
1365+
log_trace!(self.logger, "found federation_id {:?}", fed_id);
1366+
1367+
let fedimint_client = federation_lock.get(fed_id).ok_or(MutinyError::NotFound)?;
1368+
log_trace!(
1369+
self.logger,
1370+
"got fedimint client for federation_id {:?}",
1371+
fed_id
1372+
);
1373+
1374+
fedimint_client.reissue(oob_notes).await?;
1375+
log_trace!(
1376+
self.logger,
1377+
"successfully reissued for federation_id {:?}",
1378+
fed_id
1379+
);
1380+
1381+
Ok(())
13711382
} else {
1372-
return Err(MutinyError::NotFound);
1383+
Err(MutinyError::NotFound)
13731384
}
13741385
}
13751386

mutiny-wasm/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ impl MutinyWallet {
10221022
Ok(self.inner.sweep_federation_balance(amount).await?.into())
10231023
}
10241024

1025-
pub async fn reissue_oob_notes(&self, oob_notes: String) -> Result<bool, MutinyJsError> {
1025+
pub async fn reissue_oob_notes(&self, oob_notes: String) -> Result<(), MutinyJsError> {
10261026
let notes = OOBNotes::from_str(&oob_notes).map_err(|e| {
10271027
log_error!(
10281028
self.inner.logger,

0 commit comments

Comments
 (0)