mirror of
https://github.com/jwinterm/grim.git
synced 2026-11-25 15:24:02 +01:00
fix: do not send over tor when service not launched
This commit is contained in:
+4
-2
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user