mirror of
https://github.com/retoaccess1/haveno-reto.git
synced 2024-11-10 05:03:35 +01:00
do not allow arbitrators to open disputes
This commit is contained in:
parent
9004c7f32a
commit
00ceeeba5f
@ -332,7 +332,15 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
|
||||
// get trade
|
||||
Trade trade = tradeManager.getTrade(dispute.getTradeId());
|
||||
if (trade == null) {
|
||||
log.warn("Dispute trade {} does not exist", dispute.getTradeId());
|
||||
String errorMsg = "Dispute trade does not exist, tradeId=" + dispute.getTradeId();
|
||||
faultHandler.handleFault(errorMsg, new IllegalStateException(errorMsg));
|
||||
return;
|
||||
}
|
||||
|
||||
// arbitrator cannot open disputes
|
||||
if (trade.isArbitrator()) {
|
||||
String errorMsg = "Arbitrators cannot open disputes.";
|
||||
faultHandler.handleFault(errorMsg, new IllegalStateException(errorMsg));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -87,9 +87,11 @@ import monero.wallet.model.MoneroTxWallet;
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
@ -168,7 +170,28 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
|
||||
|
||||
@Override
|
||||
public void cleanupDisputes() {
|
||||
// no action
|
||||
|
||||
// remove disputes opened by arbitrator, which is not allowed
|
||||
Set<Dispute> toRemoves = new HashSet<>();
|
||||
List<Dispute> disputes = getDisputeList().getList();
|
||||
for (Dispute dispute : disputes) {
|
||||
|
||||
// get dispute's trade
|
||||
final Trade trade = tradeManager.getTrade(dispute.getTradeId());
|
||||
if (trade == null) {
|
||||
log.warn("Dispute trade {} does not exist", dispute.getTradeId());
|
||||
return;
|
||||
}
|
||||
|
||||
// collect dispute if owned by arbitrator
|
||||
if (dispute.getTraderPubKeyRing().equals(trade.getArbitrator().getPubKeyRing())) {
|
||||
toRemoves.add(dispute);
|
||||
}
|
||||
}
|
||||
for (Dispute toRemove : toRemoves) {
|
||||
log.warn("Removing invalid dispute opened by arbitrator, disputeId={}", toRemove.getTradeId(), toRemove.getId());
|
||||
getDisputeList().remove(toRemove);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user