mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-23 04:29:22 +00:00
rely on trade state to delete wallet
This commit is contained in:
parent
3aab3f57b1
commit
c55fb927f2
1 changed files with 4 additions and 16 deletions
|
@ -890,26 +890,14 @@ public abstract class Trade implements Tradable, Model {
|
||||||
synchronized (walletLock) {
|
synchronized (walletLock) {
|
||||||
if (walletExists()) {
|
if (walletExists()) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// check if synced
|
|
||||||
if (!isSyncedWithinTolerance()) {
|
|
||||||
log.warn("Refusing to delete wallet for {} {} because it is not synced within tolerance", getClass().getSimpleName(), getId());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if balance > 0
|
// check if deposits published and payout not unlocked
|
||||||
if (wallet.getBalance().compareTo(BigInteger.ZERO) > 0) {
|
|
||||||
log.warn("Refusing to delete wallet for {} {} because it contains a balance", getClass().getSimpleName(), getId());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if funds deposited but payout not unlocked
|
|
||||||
if (isDepositsPublished() && !isPayoutUnlocked()) {
|
if (isDepositsPublished() && !isPayoutUnlocked()) {
|
||||||
throw new RuntimeException("Refusing to delete wallet for " + getClass().getSimpleName() + " " + getId() + " because the deposit txs have been published but payout tx has not unlocked");
|
throw new RuntimeException("Refusing to delete wallet for " + getClass().getSimpleName() + " " + getId() + " because the deposit txs have been published but payout tx has not unlocked");
|
||||||
}
|
}
|
||||||
|
|
||||||
// force stop the wallet
|
// force stop the wallet
|
||||||
stopWallet();
|
if (wallet != null) stopWallet();
|
||||||
|
|
||||||
// delete wallet
|
// delete wallet
|
||||||
log.info("Deleting wallet for {} {}", getClass().getSimpleName(), getId());
|
log.info("Deleting wallet for {} {}", getClass().getSimpleName(), getId());
|
||||||
|
@ -918,9 +906,9 @@ public abstract class Trade implements Tradable, Model {
|
||||||
// delete trade wallet backups unless deposits requested and payouts not unlocked
|
// delete trade wallet backups unless deposits requested and payouts not unlocked
|
||||||
if (isDepositRequested() && !isDepositFailed() && !isPayoutUnlocked()) {
|
if (isDepositRequested() && !isDepositFailed() && !isPayoutUnlocked()) {
|
||||||
log.warn("Refusing to delete backup wallet for " + getClass().getSimpleName() + " " + getId() + " in the small chance it becomes funded");
|
log.warn("Refusing to delete backup wallet for " + getClass().getSimpleName() + " " + getId() + " in the small chance it becomes funded");
|
||||||
return;
|
} else {
|
||||||
|
xmrWalletService.deleteWalletBackups(getWalletName());
|
||||||
}
|
}
|
||||||
xmrWalletService.deleteWalletBackups(getWalletName());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn(e.getMessage());
|
log.warn(e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in a new issue