Skip to content

Commit

Permalink
Merge pull request #39 from mwcproject/v5.3.1/tor_restart
Browse files Browse the repository at this point in the history
Restart TOR when outage is detected
  • Loading branch information
bayk committed Sep 5, 2024
2 parents 997cbab + 4e7528f commit 1f8824d
Show file tree
Hide file tree
Showing 8 changed files with 193 additions and 117 deletions.
2 changes: 1 addition & 1 deletion api/src/owner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ where
})?;

let other_wallet_version = comm_adapter
.check_other_wallet_version(&sa.dest)
.check_other_wallet_version(&sa.dest, true)
.map_err(|e| {
Error::GenericError(format!("Unable to get other wallet info, {}", e))
})?;
Expand Down
4 changes: 2 additions & 2 deletions config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,12 @@ impl GlobalWalletConfig {
global::ChainTypes::Mainnet => {}
global::ChainTypes::Floonet => {
defaults.api_listen_port = 13415;
defaults.libp2p_listen_port = Some(13418);
defaults.libp2p_listen_port = None; // Some(13418);
defaults.check_node_api_http_addr = "http://127.0.0.1:13413".to_owned();
}
global::ChainTypes::UserTesting => {
defaults.api_listen_port = 23415;
defaults.libp2p_listen_port = Some(23418);
defaults.libp2p_listen_port = None; // Some(23418);
defaults.check_node_api_http_addr = "http://127.0.0.1:23413".to_owned();
}
_ => {}
Expand Down
2 changes: 1 addition & 1 deletion config/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl Default for WalletConfig {
chain_type: Some(ChainTypes::Mainnet),
api_listen_interface: "127.0.0.1".to_string(),
api_listen_port: 3415,
libp2p_listen_port: Some(3418),
libp2p_listen_port: None, //Some(3418),
owner_api_listen_port: Some(WalletConfig::default_owner_api_listen_port()),
api_secret_path: Some(".owner_api_secret".to_string()),
node_api_secret_path: Some(".api_secret".to_string()),
Expand Down
7 changes: 4 additions & 3 deletions controller/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,8 @@ where
"http" | "mwcmqs" => {
let sender =
create_sender(&args.method, &args.dest, &args.apisecret, tor_config)?;
let other_wallet_version = sender.check_other_wallet_version(&args.dest)?;
let other_wallet_version =
sender.check_other_wallet_version(&args.dest, true)?;
if let Some(other_wallet_version) = &other_wallet_version {
if init_args.target_slate_version.is_none() {
init_args.target_slate_version =
Expand Down Expand Up @@ -1428,7 +1429,7 @@ where
SlatePurpose::InvoiceResponse,
&slatepack_secret,
sender_pk,
sender.check_other_wallet_version(&args.dest)?,
sender.check_other_wallet_version(&args.dest, true)?,
height,
&secp,
)?;
Expand Down Expand Up @@ -4134,7 +4135,7 @@ where
let dest = format!("http://{}.onion", this_tor_address);

let sender = create_sender("tor", &dest, &None, Some(tor_config.clone()))?;
match sender.check_other_wallet_version(&dest) {
match sender.check_other_wallet_version(&dest, false) {
Ok(_) => println!("Tor connection online"),
Err(e) => println!("Tor is offline, {}", e),
}
Expand Down
Loading

0 comments on commit 1f8824d

Please sign in to comment.