mirror of
https://github.com/jwinterm/grim.git
synced 2026-11-22 22:03:55 +01:00
fix: action repeat tor tx, no resend for tor
This commit is contained in:
+9
-6
@@ -347,12 +347,6 @@ impl WalletTransaction {
|
||||
self.data.tx_type != TxLogEntryType::TxSentCancelled
|
||||
}
|
||||
|
||||
/// Check if transaction can be sent over Tor again.
|
||||
pub fn can_resend_tor(&self) -> bool {
|
||||
!self.sending_tor() && (self.state == SlateState::Standard1 ||
|
||||
self.state == SlateState::Invoice1) && self.receiver.is_some()
|
||||
}
|
||||
|
||||
/// Check if transaction is finalizing.
|
||||
pub fn finalizing(&self) -> bool {
|
||||
if let Some(a) = self.action.as_ref() {
|
||||
@@ -361,6 +355,15 @@ impl WalletTransaction {
|
||||
false
|
||||
}
|
||||
|
||||
/// Check if possible to repeat transaction action.
|
||||
pub fn can_repeat_action(&self) -> bool {
|
||||
if let Some(a) = &self.action {
|
||||
return self.action_error.is_some() && a != &WalletTransactionAction::SendingTor &&
|
||||
a != &WalletTransactionAction::Cancelling
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
/// Check if transaction is broadcasting after finalization.
|
||||
pub fn broadcasting(&self) -> bool {
|
||||
!self.data.confirmed && self.finalized()
|
||||
|
||||
@@ -1329,13 +1329,13 @@ async fn handle_task(w: &Wallet, t: WalletTask) {
|
||||
w.send_creating.store(true, Ordering::Relaxed);
|
||||
if let Ok(s) = w.send(*a, r.clone()) {
|
||||
sync_wallet_data(&w, false);
|
||||
w.send_creating.store(false, Ordering::Relaxed);
|
||||
if let Some(r) = r {
|
||||
send_tor(&s, r).await;
|
||||
} else {
|
||||
w.on_tx_result(&s);
|
||||
}
|
||||
}
|
||||
w.send_creating.store(false, Ordering::Relaxed);
|
||||
}
|
||||
WalletTask::SendTor(id, r) => {
|
||||
if let Some(s) = w.get_tx(*id) {
|
||||
@@ -1355,6 +1355,7 @@ async fn handle_task(w: &Wallet, t: WalletTask) {
|
||||
None => &w.get_tx(*id).unwrap(),
|
||||
Some(s) => s
|
||||
};
|
||||
w.on_tx_error(slate.id.to_string(), None);
|
||||
match w.finalize(slate) {
|
||||
Ok(s) => {
|
||||
match w.post(&s) {
|
||||
@@ -1376,6 +1377,7 @@ async fn handle_task(w: &Wallet, t: WalletTask) {
|
||||
None => &w.get_tx(*id).unwrap(),
|
||||
Some(s) => s
|
||||
};
|
||||
w.on_tx_error(slate.id.to_string(), None);
|
||||
|
||||
// Cleanup broadcasting tx height.
|
||||
let has_data = {
|
||||
|
||||
Reference in New Issue
Block a user