Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix trade protocol check for refund agent ticket close #4615

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@

import bisq.network.p2p.NodeAddress;

import bisq.common.app.Version;
import bisq.common.crypto.KeyRing;
import bisq.common.crypto.PubKeyRing;
import bisq.common.util.Utilities;
Expand Down Expand Up @@ -475,16 +474,6 @@ protected void reOpenDisputeFromButton() {

protected abstract void handleOnSelectDispute(Dispute dispute);

protected void onCloseDispute(Dispute dispute) {
long protocolVersion = dispute.getContract().getOfferPayload().getProtocolVersion();
if (protocolVersion == Version.TRADE_PROTOCOL_VERSION) {
disputeSummaryWindow.onFinalizeDispute(() -> chatView.removeInputBox())
.show(dispute);
} else {
new Popup().warning(Res.get("support.wrongVersion", protocolVersion)).show();
}
}

protected void reOpenDispute() {
if (selectedDispute != null) {
selectedDispute.setIsClosed(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ protected void setupTable() {
tableView.getColumns().add(getAlertColumn());
}

protected abstract void onCloseDispute(Dispute dispute);


///////////////////////////////////////////////////////////////////////////////////////////
// Private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package bisq.desktop.main.support.dispute.agent.arbitration;

import bisq.desktop.common.view.FxmlView;
import bisq.desktop.main.overlays.popups.Popup;
import bisq.desktop.main.overlays.windows.ContractWindow;
import bisq.desktop.main.overlays.windows.DisputeSummaryWindow;
import bisq.desktop.main.overlays.windows.TradeDetailsWindow;
Expand All @@ -26,6 +27,7 @@
import bisq.core.account.witness.AccountAgeWitnessService;
import bisq.core.alert.PrivateNotificationManager;
import bisq.core.dao.DaoFacade;
import bisq.core.locale.Res;
import bisq.core.support.SupportType;
import bisq.core.support.dispute.Dispute;
import bisq.core.support.dispute.DisputeSession;
Expand Down Expand Up @@ -84,4 +86,17 @@ protected SupportType getType() {
protected DisputeSession getConcreteDisputeChatSession(Dispute dispute) {
return new ArbitrationSession(dispute, disputeManager.isTrader(dispute));
}

@Override
protected void onCloseDispute(Dispute dispute) {
long protocolVersion = dispute.getContract().getOfferPayload().getProtocolVersion();
// Only cases with protocolVersion 1 are candidates for legacy arbitration.
// This code path is not tested and it is not assumed that it is still be used as old arbitrators would use
// their old Bisq version if still cases are pending.
if (protocolVersion == 1) {
disputeSummaryWindow.onFinalizeDispute(() -> chatView.removeInputBox()).show(dispute);
} else {
new Popup().warning(Res.get("support.wrongVersion", protocolVersion)).show();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ protected DisputeSession getConcreteDisputeChatSession(Dispute dispute) {

@Override
protected void onCloseDispute(Dispute dispute) {
disputeSummaryWindow.onFinalizeDispute(() -> chatView.removeInputBox())
.show(dispute);
disputeSummaryWindow.onFinalizeDispute(() -> chatView.removeInputBox()).show(dispute);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package bisq.desktop.main.support.dispute.agent.refund;

import bisq.desktop.common.view.FxmlView;
import bisq.desktop.main.overlays.popups.Popup;
import bisq.desktop.main.overlays.windows.ContractWindow;
import bisq.desktop.main.overlays.windows.DisputeSummaryWindow;
import bisq.desktop.main.overlays.windows.TradeDetailsWindow;
Expand All @@ -26,6 +27,7 @@
import bisq.core.account.witness.AccountAgeWitnessService;
import bisq.core.alert.PrivateNotificationManager;
import bisq.core.dao.DaoFacade;
import bisq.core.locale.Res;
import bisq.core.support.SupportType;
import bisq.core.support.dispute.Dispute;
import bisq.core.support.dispute.DisputeSession;
Expand Down Expand Up @@ -84,4 +86,15 @@ protected SupportType getType() {
protected DisputeSession getConcreteDisputeChatSession(Dispute dispute) {
return new RefundSession(dispute, disputeManager.isTrader(dispute));
}

@Override
protected void onCloseDispute(Dispute dispute) {
long protocolVersion = dispute.getContract().getOfferPayload().getProtocolVersion();
// Refund agent was introduced with protocolVersion version 2. We do not support old trade protocol cases.
if (protocolVersion >= 2) {
disputeSummaryWindow.onFinalizeDispute(() -> chatView.removeInputBox()).show(dispute);
} else {
new Popup().warning(Res.get("support.wrongVersion", protocolVersion)).show();
}
}
}