skip wallet checks on deletion if deposit not requested

This commit is contained in:
woodser 2024-07-19 14:38:05 -04:00
parent 5d739f912c
commit eb8025f6e8

View file

@ -967,6 +967,9 @@ public abstract class Trade implements Tradable, Model {
if (walletExists()) {
try {
// check wallet state if deposit requested
if (isDepositRequested()) {
// ensure wallet is initialized
boolean syncedWallet = false;
if (wallet == null) {
@ -977,7 +980,7 @@ public abstract class Trade implements Tradable, Model {
}
// sync wallet if deposit requested and payout not unlocked
if (isDepositRequested() && !isPayoutUnlocked() && !syncedWallet) {
if (!isPayoutUnlocked() && !syncedWallet) {
log.warn("Syncing wallet on deletion for trade {} {}, syncing", getClass().getSimpleName(), getId());
syncWallet(true);
}
@ -989,7 +992,6 @@ public abstract class Trade implements Tradable, Model {
// check for balance
if (wallet.getBalance().compareTo(BigInteger.ZERO) > 0) {
synchronized (HavenoUtils.getDaemonLock()) {
log.warn("Rescanning spent outputs for {} {}", getClass().getSimpleName(), getId());
wallet.rescanSpent();
if (wallet.getBalance().compareTo(BigInteger.ZERO) > 0) {
@ -1656,8 +1658,9 @@ public abstract class Trade implements Tradable, Model {
private void removeTradeOnError() {
log.warn("removeTradeOnError() trade={}, tradeId={}, state={}", getClass().getSimpleName(), getShortId(), getState());
// force close wallet in case stuck
// force close and re-open wallet in case stuck
forceCloseWallet();
if (isDepositRequested()) getWallet();
// shut down trade thread
try {