mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-10-13 11:01:08 -04:00
avoid blocking by checking if wallet exists without lock
This commit is contained in:
parent
1a3bee0300
commit
60ee90f53b
3 changed files with 8 additions and 6 deletions
|
@ -70,7 +70,7 @@ public abstract class SellerTrade extends Trade {
|
|||
|
||||
public boolean needsToResendPaymentReceivedMessages() {
|
||||
boolean hasNoPaymentReceivedMessages = getBuyer().getPaymentReceivedMessage() == null && getArbitrator().getPaymentReceivedMessage() == null;
|
||||
if (!walletExists() && !hasNoPaymentReceivedMessages) return false; // cannot provide any updated state
|
||||
if (!walletExistsNoSync() && !hasNoPaymentReceivedMessages) return false; // cannot provide any updated state
|
||||
return !isShutDownStarted() && getState().ordinal() >= Trade.State.SELLER_SENT_PAYMENT_RECEIVED_MSG.ordinal() && !getProcessModel().isPaymentReceivedMessagesAckedOrStored() && resendPaymentReceivedMessagesEnabled() && resendPaymentReceivedMessagesWithinDuration();
|
||||
}
|
||||
|
||||
|
|
|
@ -823,7 +823,7 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
|
|||
// Note that this function is overriden by subclasses.
|
||||
public boolean isFinished() {
|
||||
if (!isCompleted()) return false;
|
||||
if (isPayoutUnlocked() && !walletExists()) return true;
|
||||
if (isPayoutUnlocked() && !walletExistsNoSync()) return true;
|
||||
return isPayoutFinalized();
|
||||
}
|
||||
|
||||
|
@ -909,7 +909,7 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean walletExistsNoSync() {
|
||||
protected boolean walletExistsNoSync() {
|
||||
return xmrWalletService.walletExists(getWalletName());
|
||||
}
|
||||
|
||||
|
@ -958,7 +958,7 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
|
|||
|
||||
public boolean isIdling() {
|
||||
if (isPayoutUnlocked()) return true; // idle after payout unlocked
|
||||
return this instanceof ArbitratorTrade && isDepositsConfirmed() && walletExists() && pollNormalStartTimeMs == null; // arbitrator idles trade after deposits confirm unless overriden
|
||||
return this instanceof ArbitratorTrade && isDepositsConfirmed() && walletExistsNoSync() && pollNormalStartTimeMs == null; // arbitrator idles trade after deposits confirm unless overriden
|
||||
}
|
||||
|
||||
public boolean isSyncedWithinTolerance() {
|
||||
|
|
|
@ -1901,9 +1901,11 @@ public class XmrWalletService extends XmrWalletBase {
|
|||
List<Trade> trades = tradeManager.getAllTrades();
|
||||
for (Trade trade : trades) {
|
||||
tasks.add(() -> {
|
||||
synchronized (trade.getWalletLock()) {
|
||||
if (trade.walletExists()) {
|
||||
trade.changeWalletPassword(oldPassword, newPassword); // TODO (woodser): this unnecessarily connects and syncs unopen wallets and leaves open
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue