fix: do not send over tor when service not launched

This commit is contained in:
ardocrat
2026-04-10 00:28:27 +03:00
parent 31bc74529c
commit 6835bb1909
5 changed files with 15 additions and 11 deletions
+4 -2
View File
@@ -20,6 +20,7 @@ use grin_wallet_util::OnionV3Address;
use serde_derive::{Deserialize, Serialize};
use std::sync::Arc;
use crate::tor::Tor;
use crate::wallet::Wallet;
/// Mnemonic phrase word.
@@ -377,12 +378,13 @@ impl WalletTx {
}
/// Check if possible to repeat transaction action.
pub fn can_repeat_action(&self) -> bool {
pub fn can_repeat_action(&self, wallet: &Wallet) -> bool {
if let Some(a) = &self.action {
self.action_error.is_some() && a != &WalletTxAction::Cancelling
} else {
// Can resend over Tor.
!self.data.confirmed && !self.sending_tor() && !self.broadcasting() &&
!self.data.confirmed && !self.sending_tor() &&
Tor::is_service_running(&wallet.identifier()) && !self.broadcasting() &&
self.receiver.is_some()
}
}
+7 -3
View File
@@ -1735,9 +1735,13 @@ async fn handle_task(w: &Wallet, t: WalletTask) {
let tx = w.retrieve_tx_by_id(None, Some(s.id));
if let Some(tx) = tx {
if let Some(addr) = r {
w.send_creating.store(false, Ordering::Relaxed);
send_tor(tx, &s, addr).await;
return;
if Tor::is_service_running(&w.identifier()) {
w.send_creating.store(false, Ordering::Relaxed);
send_tor(tx, &s, addr).await;
return;
} else {
w.on_task_result(Some(tx), &t);
}
} else {
w.on_task_result(Some(tx), &t);
}