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
if (isPayoutUnlocked()) {
if (walletExists()) deleteWallet();
maybeClearProcessData();
return;
}
@ -662,6 +662,7 @@ public abstract class Trade implements Tradable, Model {
if (!isInitialized) return;
log.info("Payout unlocked for {} {}, deleting multisig wallet", getClass().getSimpleName(), getId());
deleteWallet();
maybeClearProcessData();
if (idlePayoutSyncer != null) {
xmrWalletService.removeWalletListener(idlePayoutSyncer);
idlePayoutSyncer = null;
@ -1144,6 +1145,24 @@ public abstract class Trade implements Tradable, Model {
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() {
String change = "";
if (removeAllChatMessages()) {