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

Commit

Permalink
Verify fedimint network
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman committed Jan 11, 2024
1 parent ff4410b commit 620ad36
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion mutiny-core/src/federation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use fedimint_ln_client::{
};
use fedimint_ln_common::LightningCommonInit;
use fedimint_mint_client::MintClientInit;
use fedimint_wallet_client::WalletClientInit;
use fedimint_wallet_client::{WalletClientInit, WalletClientModule};
use futures::future::{self};
use futures_util::{pin_mut, StreamExt};
use lightning::{log_debug, log_error, log_info, log_trace, log_warn, util::logger::Logger};
Expand Down Expand Up @@ -174,6 +174,17 @@ impl FederationClient {
))
.await?;

// check federation is on expected network
let wallet_client = fedimint_client.get_first_module::<WalletClientModule>();
if network != wallet_client.get_network() {
log_error!(
logger,
"Fedimint on different network {}, expected: {network}",
wallet_client.get_network()
);
return Err(MutinyError::IncorrectNetwork(network));
}

log_debug!(logger, "Built fedimint client");
Ok(FederationClient {
uuid,
Expand Down

0 comments on commit 620ad36

Please sign in to comment.