mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-25 07:27:18 +01:00
Fix bug at mediation with old client
If dispute opener is old client the delayed payout tx is not sent in mediation case (only in refund agent cases). At 1.4.0 we send it as well in mediation case and the mediator get a warning shown in case its missing. To avoid that warning we check if dispute is of refund agent type and only check in that case. This can be removed once we have enforced update to 1.4.0 (segwit will require that). Also added checks to not add null entries in the duplicates checks.
This commit is contained in:
parent
41b2e6a56d
commit
3b4d109652
2 changed files with 30 additions and 15 deletions
|
@ -103,7 +103,7 @@ public final class Dispute implements NetworkPayload, PersistablePayload {
|
||||||
@Nullable
|
@Nullable
|
||||||
private String delayedPayoutTxId;
|
private String delayedPayoutTxId;
|
||||||
|
|
||||||
// Added at v1.3.9
|
// Added at v1.4.0
|
||||||
@Setter
|
@Setter
|
||||||
@Nullable
|
@Nullable
|
||||||
private String donationAddressOfDelayedPayoutTx;
|
private String donationAddressOfDelayedPayoutTx;
|
||||||
|
|
|
@ -20,6 +20,7 @@ package bisq.core.trade;
|
||||||
import bisq.core.btc.wallet.BtcWalletService;
|
import bisq.core.btc.wallet.BtcWalletService;
|
||||||
import bisq.core.dao.DaoFacade;
|
import bisq.core.dao.DaoFacade;
|
||||||
import bisq.core.offer.Offer;
|
import bisq.core.offer.Offer;
|
||||||
|
import bisq.core.support.SupportType;
|
||||||
import bisq.core.support.dispute.Dispute;
|
import bisq.core.support.dispute.Dispute;
|
||||||
import bisq.core.util.validation.RegexValidatorFactory;
|
import bisq.core.util.validation.RegexValidatorFactory;
|
||||||
|
|
||||||
|
@ -136,14 +137,18 @@ public class TradeDataValidation {
|
||||||
set.add(uid);
|
set.add(uid);
|
||||||
|
|
||||||
String delayedPayoutTxId = dispute.getDelayedPayoutTxId();
|
String delayedPayoutTxId = dispute.getDelayedPayoutTxId();
|
||||||
|
if (delayedPayoutTxId != null) {
|
||||||
disputesPerDelayedPayoutTxId.putIfAbsent(delayedPayoutTxId, new HashSet<>());
|
disputesPerDelayedPayoutTxId.putIfAbsent(delayedPayoutTxId, new HashSet<>());
|
||||||
set = disputesPerDelayedPayoutTxId.get(delayedPayoutTxId);
|
set = disputesPerDelayedPayoutTxId.get(delayedPayoutTxId);
|
||||||
set.add(uid);
|
set.add(uid);
|
||||||
|
}
|
||||||
|
|
||||||
String depositTxId = dispute.getDepositTxId();
|
String depositTxId = dispute.getDepositTxId();
|
||||||
|
if (depositTxId != null) {
|
||||||
disputesPerDepositTxId.putIfAbsent(depositTxId, new HashSet<>());
|
disputesPerDepositTxId.putIfAbsent(depositTxId, new HashSet<>());
|
||||||
set = disputesPerDepositTxId.get(depositTxId);
|
set = disputesPerDepositTxId.get(depositTxId);
|
||||||
set.add(uid);
|
set.add(uid);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return new Tuple3<>(disputesPerTradeId, disputesPerDelayedPayoutTxId, disputesPerDepositTxId);
|
return new Tuple3<>(disputesPerTradeId, disputesPerDelayedPayoutTxId, disputesPerDepositTxId);
|
||||||
|
@ -161,8 +166,14 @@ public class TradeDataValidation {
|
||||||
String disputeToTestDepositTxId = disputeToTest.getDepositTxId();
|
String disputeToTestDepositTxId = disputeToTest.getDepositTxId();
|
||||||
String disputeToTestUid = disputeToTest.getUid();
|
String disputeToTestUid = disputeToTest.getUid();
|
||||||
|
|
||||||
|
// For pre v1.4.0 we do not get the delayed payout tx sent in mediation cases but in refund agent case we do.
|
||||||
|
// So until all users have updated to 1.4.0 we only check in refund agent case. With 1.4.0 we send the
|
||||||
|
// delayed payout tx also in mediation cases and that if check can be removed.
|
||||||
|
if (disputeToTest.getSupportType() == SupportType.REFUND) {
|
||||||
checkNotNull(disputeToTestDelayedPayoutTxId,
|
checkNotNull(disputeToTestDelayedPayoutTxId,
|
||||||
"delayedPayoutTxId must not be null. Trade ID: " + disputeToTestTradeId);
|
"Delayed payout transaction ID is null. " +
|
||||||
|
"Trade ID: " + disputeToTestTradeId);
|
||||||
|
}
|
||||||
checkNotNull(disputeToTestDepositTxId,
|
checkNotNull(disputeToTestDepositTxId,
|
||||||
"depositTxId must not be null. Trade ID: " + disputeToTestTradeId);
|
"depositTxId must not be null. Trade ID: " + disputeToTestTradeId);
|
||||||
checkNotNull(disputeToTestUid,
|
checkNotNull(disputeToTestUid,
|
||||||
|
@ -171,12 +182,16 @@ public class TradeDataValidation {
|
||||||
checkArgument(disputesPerTradeId.get(disputeToTestTradeId).size() <= 2,
|
checkArgument(disputesPerTradeId.get(disputeToTestTradeId).size() <= 2,
|
||||||
"We found more then 2 disputes with the same trade ID. " +
|
"We found more then 2 disputes with the same trade ID. " +
|
||||||
"Trade ID: " + disputeToTestTradeId);
|
"Trade ID: " + disputeToTestTradeId);
|
||||||
|
if (!disputesPerDelayedPayoutTxId.isEmpty()) {
|
||||||
checkArgument(disputesPerDelayedPayoutTxId.get(disputeToTestDelayedPayoutTxId).size() <= 2,
|
checkArgument(disputesPerDelayedPayoutTxId.get(disputeToTestDelayedPayoutTxId).size() <= 2,
|
||||||
"We found more then 2 disputes with the same delayedPayoutTxId. " +
|
"We found more then 2 disputes with the same delayedPayoutTxId. " +
|
||||||
"Trade ID: " + disputeToTestTradeId);
|
"Trade ID: " + disputeToTestTradeId);
|
||||||
|
}
|
||||||
|
if (!disputesPerDepositTxId.isEmpty()) {
|
||||||
checkArgument(disputesPerDepositTxId.get(disputeToTestDepositTxId).size() <= 2,
|
checkArgument(disputesPerDepositTxId.get(disputeToTestDepositTxId).size() <= 2,
|
||||||
"We found more then 2 disputes with the same depositTxId. " +
|
"We found more then 2 disputes with the same depositTxId. " +
|
||||||
"Trade ID: " + disputeToTestTradeId);
|
"Trade ID: " + disputeToTestTradeId);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (IllegalArgumentException | NullPointerException e) {
|
} catch (IllegalArgumentException | NullPointerException e) {
|
||||||
throw new DisputeReplayException(disputeToTest, e.getMessage());
|
throw new DisputeReplayException(disputeToTest, e.getMessage());
|
||||||
|
|
Loading…
Add table
Reference in a new issue