check for balance before deleting trade wallet

This commit is contained in:
woodser 2024-01-02 10:15:17 -05:00
parent 20b55ed9dd
commit 2ee2b747f9

View File

@ -905,6 +905,11 @@ public abstract class Trade implements Tradable, Model {
throw new RuntimeException("Refusing to delete wallet for " + getClass().getSimpleName() + " " + getId() + " because the deposit txs have been published but payout tx has not unlocked");
}
// check for balance
if (wallet != null && wallet.getBalance().compareTo(BigInteger.ZERO) > 0) {
throw new RuntimeException("Refusing to delete wallet for " + getClass().getSimpleName() + " " + getId() + " because it has a balance");
}
// force stop the wallet
if (wallet != null) stopWallet();