clear basic trade process data on payout unlocked

This commit is contained in:
woodser 2023-12-09 11:41:52 -05:00
parent 948be8ce29
commit 74cfd474ad

View file

@ -595,7 +595,7 @@ public abstract class Trade implements Tradable, Model {
// check if done // check if done
if (isPayoutUnlocked()) { if (isPayoutUnlocked()) {
if (walletExists()) deleteWallet(); maybeClearProcessData();
return; return;
} }
@ -662,6 +662,7 @@ public abstract class Trade implements Tradable, Model {
if (!isInitialized) return; if (!isInitialized) return;
log.info("Payout unlocked for {} {}, deleting multisig wallet", getClass().getSimpleName(), getId()); log.info("Payout unlocked for {} {}, deleting multisig wallet", getClass().getSimpleName(), getId());
deleteWallet(); deleteWallet();
maybeClearProcessData();
if (idlePayoutSyncer != null) { if (idlePayoutSyncer != null) {
xmrWalletService.removeWalletListener(idlePayoutSyncer); xmrWalletService.removeWalletListener(idlePayoutSyncer);
idlePayoutSyncer = null; idlePayoutSyncer = null;
@ -1144,6 +1145,24 @@ public abstract class Trade implements Tradable, Model {
return payoutAmountFromMediation < normalPayoutAmount; return payoutAmountFromMediation < normalPayoutAmount;
} }
public void maybeClearProcessData() {
synchronized (walletLock) {
// skip if already cleared
if (!walletExists()) return;
// delete trade wallet
deleteWallet();
// TODO: clear other process data
setPayoutTxHex(null);
for (TradePeer peer : getPeers()) {
peer.setUnsignedPayoutTxHex(null);
peer.setUpdatedMultisigHex(null);
}
}
}
public void maybeClearSensitiveData() { public void maybeClearSensitiveData() {
String change = ""; String change = "";
if (removeAllChatMessages()) { if (removeAllChatMessages()) {