diff --git a/core/src/main/java/haveno/core/support/dispute/DisputeManager.java b/core/src/main/java/haveno/core/support/dispute/DisputeManager.java index 9d81758b..2f9db775 100644 --- a/core/src/main/java/haveno/core/support/dispute/DisputeManager.java +++ b/core/src/main/java/haveno/core/support/dispute/DisputeManager.java @@ -468,7 +468,7 @@ public abstract class DisputeManager> extends Sup try { DisputeValidation.validateDisputeData(dispute); DisputeValidation.validateNodeAddresses(dispute, config); - DisputeValidation.validateSenderNodeAddress(dispute, message.getSenderNodeAddress()); + DisputeValidation.validateSenderNodeAddress(dispute, message.getSenderNodeAddress(), config); //DisputeValidation.testIfDisputeTriesReplay(dispute, disputeList.getList()); } catch (DisputeValidation.ValidationException e) { e.printStackTrace(); @@ -477,9 +477,8 @@ public abstract class DisputeManager> extends Sup } // try to validate payment account - // TODO: add field to dispute details: valid, invalid, missing try { - DisputeValidation.validatePaymentAccountPayload(dispute); + DisputeValidation.validatePaymentAccountPayload(dispute); // TODO: add field to dispute details: valid, invalid, missing } catch (Exception e) { e.printStackTrace(); log.warn(e.getMessage()); @@ -491,6 +490,9 @@ public abstract class DisputeManager> extends Sup TradePeer sender = trade.getTradePeer(senderPubKeyRing); if (sender == null) throw new RuntimeException("Pub key ring is not from arbitrator, buyer, or seller"); + // update sender node address + sender.setNodeAddress(message.getSenderNodeAddress()); + // message to trader is expected from arbitrator if (!trade.isArbitrator() && sender != trade.getArbitrator()) { throw new RuntimeException(message.getClass().getSimpleName() + " to trader is expected only from arbitrator"); diff --git a/core/src/main/java/haveno/core/support/dispute/DisputeValidation.java b/core/src/main/java/haveno/core/support/dispute/DisputeValidation.java index fb3cc6a3..78fabde2 100644 --- a/core/src/main/java/haveno/core/support/dispute/DisputeValidation.java +++ b/core/src/main/java/haveno/core/support/dispute/DisputeValidation.java @@ -77,20 +77,21 @@ public class DisputeValidation { public static void validateSenderNodeAddress(Dispute dispute, - NodeAddress senderNodeAddress) throws NodeAddressException { - if (!senderNodeAddress.equals(dispute.getContract().getBuyerNodeAddress()) - && !senderNodeAddress.equals(dispute.getContract().getSellerNodeAddress()) - && !senderNodeAddress.equals(dispute.getContract().getArbitratorNodeAddress())) { - throw new NodeAddressException(dispute, "senderNodeAddress not matching any of the traders node addresses"); + NodeAddress senderNodeAddress, + Config config) throws NodeAddressException { + if (config.useLocalhostForP2P) return; + if (!senderNodeAddress.getHostName().equals(dispute.getContract().getBuyerNodeAddress().getHostName()) + && !senderNodeAddress.getHostName().equals(dispute.getContract().getSellerNodeAddress().getHostName()) + && !senderNodeAddress.getHostName().equals(dispute.getContract().getArbitratorNodeAddress().getHostName())) { + throw new NodeAddressException(dispute, "senderNodeAddress not matching any of the trade node addresses"); } } public static void validateNodeAddresses(Dispute dispute, Config config) throws NodeAddressException { - if (!config.useLocalhostForP2P) { - validateNodeAddress(dispute, dispute.getContract().getBuyerNodeAddress()); - validateNodeAddress(dispute, dispute.getContract().getSellerNodeAddress()); - } + if (config.useLocalhostForP2P) return; + validateNodeAddress(dispute, dispute.getContract().getBuyerNodeAddress()); + validateNodeAddress(dispute, dispute.getContract().getSellerNodeAddress()); } private static void validateNodeAddress(Dispute dispute, NodeAddress nodeAddress) throws NodeAddressException {