From 74cfd474addea4bb303d07944465ea6576b8916d Mon Sep 17 00:00:00 2001 From: woodser Date: Sat, 9 Dec 2023 11:41:52 -0500 Subject: [PATCH] clear basic trade process data on payout unlocked --- .../main/java/haveno/core/trade/Trade.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/haveno/core/trade/Trade.java b/core/src/main/java/haveno/core/trade/Trade.java index 1efff6f7..32d9542d 100644 --- a/core/src/main/java/haveno/core/trade/Trade.java +++ b/core/src/main/java/haveno/core/trade/Trade.java @@ -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()) {