Removing star and unused imports with checkstyle

This commit is contained in:
napoly 2023-03-14 20:28:47 +01:00 committed by woodser
parent ce05710537
commit 3b8f19c4ce
1206 changed files with 5197 additions and 6620 deletions

View file

@ -39,16 +39,15 @@ import haveno.network.p2p.P2PService;
import haveno.network.p2p.SendMailboxMessageListener;
import haveno.network.p2p.mailbox.MailboxMessage;
import haveno.network.p2p.mailbox.MailboxMessageService;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArraySet;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
@Slf4j
public abstract class SupportManager {
protected final P2PService p2PService;
@ -324,7 +323,7 @@ public abstract class SupportManager {
}
}
///////////////////////////////////////////////////////////////////////////////////////////
// Private
///////////////////////////////////////////////////////////////////////////////////////////

View file

@ -17,7 +17,6 @@
package haveno.core.support;
import haveno.common.crypto.PubKeyRing;
import haveno.core.support.messages.ChatMessage;
import javafx.collections.ObservableList;

View file

@ -41,10 +41,14 @@ import javafx.beans.property.ReadOnlyObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@ -54,13 +58,6 @@ import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
@Slf4j
@EqualsAndHashCode
@Getter
@ -140,7 +137,7 @@ public final class Dispute implements NetworkPayload, PersistablePayload {
@Nullable
@Setter
private Map<String, String> extraDataMap;
// Added for XMR integration
private boolean isOpener;
@Nullable
@ -492,7 +489,7 @@ public final class Dispute implements NetworkPayload, PersistablePayload {
return Res.get("support.sellerTaker");
}
}
@Nullable
public PaymentAccountPayload getBuyerPaymentAccountPayload() {
return contract.isBuyerMakerAndSellerTaker() ? makerPaymentAccountPayload : takerPaymentAccountPayload;

View file

@ -19,11 +19,11 @@ package haveno.core.support.dispute;
import haveno.common.proto.persistable.PersistableListAsObservable;
import haveno.common.proto.persistable.PersistablePayload;
import java.util.Collection;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import java.util.Collection;
@Slf4j
@ToString
/*

View file

@ -22,24 +22,20 @@ import haveno.common.persistence.PersistenceManager;
import haveno.common.proto.persistable.PersistedDataHost;
import haveno.core.trade.Contract;
import haveno.network.p2p.NodeAddress;
import org.fxmisc.easybind.EasyBind;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.collections.ObservableList;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.fxmisc.easybind.EasyBind;
import javax.annotation.Nullable;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
@Slf4j
public abstract class DisputeListService<T extends DisputeList<Dispute>> implements PersistedDataHost {
@Getter

View file

@ -55,13 +55,17 @@ import haveno.network.p2p.BootstrapListener;
import haveno.network.p2p.NodeAddress;
import haveno.network.p2p.P2PService;
import haveno.network.p2p.SendMailboxMessageListener;
import org.bitcoinj.utils.Fiat;
import javafx.beans.property.IntegerProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import monero.common.MoneroError;
import monero.wallet.model.MoneroTxConfig;
import monero.wallet.model.MoneroTxWallet;
import org.bitcoinj.utils.Fiat;
import javax.annotation.Nullable;
import java.math.BigInteger;
import java.security.KeyPair;
import java.time.Instant;
@ -74,14 +78,6 @@ import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import monero.common.MoneroError;
import monero.wallet.model.MoneroTxConfig;
import monero.wallet.model.MoneroTxWallet;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
@ -367,7 +363,7 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
p2PService.getAddress(),
UUID.randomUUID().toString(),
getSupportType(),
updatedMultisigHex,
updatedMultisigHex,
trade.getProcessModel().getPaymentSentMessage());
log.info("Send {} to peer {}. tradeId={}, openNewDisputeMessage.uid={}, " +
"chatMessage.uid={}",
@ -453,7 +449,7 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
String errorMessage = null;
PubKeyRing senderPubKeyRing = null;
try {
// initialize
T disputeList = getDisputeList();
if (disputeList == null) {
@ -463,7 +459,7 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
dispute.setSupportType(message.getSupportType());
dispute.setState(Dispute.State.NEW);
Contract contract = dispute.getContract();
// validate dispute
try {
DisputeValidation.validateDisputeData(dispute);
@ -475,35 +471,35 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
validationExceptions.add(e);
throw e;
}
// get sender
senderPubKeyRing = trade.isArbitrator() ? (dispute.isDisputeOpenerIsBuyer() ? contract.getBuyerPubKeyRing() : contract.getSellerPubKeyRing()) : trade.getArbitrator().getPubKeyRing();
TradePeer sender = trade.getTradePeer(senderPubKeyRing);
if (sender == null) throw new RuntimeException("Pub key ring is not from arbitrator, buyer, or seller");
// 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");
}
// arbitrator verifies signature of payment sent message if given
if (trade.isArbitrator() && message.getPaymentSentMessage() != null) {
HavenoUtils.verifyPaymentSentMessage(trade, message.getPaymentSentMessage());
trade.getBuyer().setUpdatedMultisigHex(message.getPaymentSentMessage().getUpdatedMultisigHex());
trade.advanceState(sender == trade.getBuyer() ? Trade.State.BUYER_SENT_PAYMENT_SENT_MSG : Trade.State.SELLER_RECEIVED_PAYMENT_SENT_MSG);
}
// update multisig hex
if (message.getUpdatedMultisigHex() != null) sender.setUpdatedMultisigHex(message.getUpdatedMultisigHex());
trade.importMultisigHex();
// update peer node address
// TODO: tests can reuse the same addresses so nullify equal peer
sender.setNodeAddress(message.getSenderNodeAddress());
// add chat message with price info
if (trade instanceof ArbitratorTrade) addPriceInfoMessage(dispute, 0);
// add dispute
synchronized (disputeList) {
if (!disputeList.contains(dispute)) {
@ -511,7 +507,7 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
if (!storedDisputeOptional.isPresent()) {
disputeList.add(dispute);
trade.advanceDisputeState(Trade.DisputeState.DISPUTE_OPENED);
// send dispute opened message to peer if arbitrator
if (trade.isArbitrator()) sendDisputeOpenedMessageToPeer(dispute, contract, dispute.isDisputeOpenerIsBuyer() ? contract.getSellerPubKeyRing() : contract.getBuyerPubKeyRing(), trade.getSelf().getUpdatedMultisigHex());
tradeManager.requestPersistence();
@ -521,7 +517,7 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
log.debug("We got a dispute already open for that trade and trading peer. TradeId = {}",
dispute.getTradeId());
}
// add chat message with mediation info if applicable
addMediationResultMessage(dispute);
} else {
@ -533,14 +529,14 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
log.warn(errorMessage);
if (trade != null) trade.setErrorMessage(errorMessage);
}
// use chat message instead of open dispute message for the ack
ObservableList<ChatMessage> messages = message.getDispute().getChatMessages();
if (!messages.isEmpty()) {
ChatMessage msg = messages.get(0);
sendAckMessage(msg, senderPubKeyRing, errorMessage == null, errorMessage);
}
requestPersistence();
}
}

View file

@ -26,17 +26,15 @@ import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import java.math.BigInteger;
import java.util.Date;
import java.util.Optional;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
import java.math.BigInteger;
import java.util.Date;
import java.util.Optional;
@EqualsAndHashCode
@Getter

View file

@ -17,12 +17,10 @@
package haveno.core.support.dispute;
import haveno.common.crypto.PubKeyRing;
import haveno.core.support.SupportSession;
import haveno.core.support.messages.ChatMessage;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;

View file

@ -24,10 +24,10 @@ import haveno.core.support.dispute.agent.DisputeAgent;
import haveno.core.support.dispute.arbitration.arbitrator.ArbitratorManager;
import haveno.core.trade.HavenoUtils;
import haveno.network.p2p.NodeAddress;
import java.security.KeyPair;
import lombok.extern.slf4j.Slf4j;
import java.security.KeyPair;
import static com.google.common.base.Preconditions.checkNotNull;
@Slf4j

View file

@ -27,11 +27,13 @@ import haveno.core.trade.Trade;
import haveno.core.util.JsonUtil;
import haveno.core.util.validation.RegexValidatorFactory;
import haveno.network.p2p.NodeAddress;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.core.Transaction;
import org.bitcoinj.core.TransactionOutput;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
@ -40,13 +42,10 @@ import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.Consumer;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
@Slf4j
public class DisputeValidation {
@ -62,7 +61,7 @@ public class DisputeValidation {
checkArgument(dispute.getContractAsJson().equals(JsonUtil.objectToJson(contract)), "Invalid contractAsJson");
checkArgument(Arrays.equals(Objects.requireNonNull(dispute.getContractHash()), Hash.getSha256Hash(checkNotNull(dispute.getContractAsJson()))),
"Invalid contractHash");
// Only the dispute opener has set the signature
byte[] makerContractSignature = dispute.getMakerContractSignature();
if (makerContractSignature != null) HavenoUtils.verifySignature(contract.getMakerPubKeyRing(), dispute.getContractAsJson(), makerContractSignature);
@ -72,19 +71,19 @@ public class DisputeValidation {
throw new ValidationException(dispute, t.getMessage());
}
}
public static void validateTradeAndDispute(Dispute dispute, Trade trade)
throws ValidationException {
try {
checkArgument(dispute.getContract().equals(trade.getContract()),
"contract must match contract from trade");
} catch (Throwable t) {
throw new ValidationException(dispute, t.getMessage());
}
}
public static void validateSenderNodeAddress(Dispute dispute,
NodeAddress senderNodeAddress) throws NodeAddressException {
if (!senderNodeAddress.equals(dispute.getContract().getBuyerNodeAddress())
@ -93,7 +92,7 @@ public class DisputeValidation {
throw new NodeAddressException(dispute, "senderNodeAddress not matching any of the traders node addresses");
}
}
public static void validateNodeAddresses(Dispute dispute, Config config)
throws NodeAddressException {
if (!config.useLocalhostForP2P) {
@ -101,7 +100,7 @@ public class DisputeValidation {
validateNodeAddress(dispute, dispute.getContract().getSellerNodeAddress());
}
}
private static void validateNodeAddress(Dispute dispute, NodeAddress nodeAddress) throws NodeAddressException {
if (!RegexValidatorFactory.onionAddressRegexValidator().validate(nodeAddress.getFullAddress()).isValid) {
String msg = "Node address " + nodeAddress.getFullAddress() + " at dispute with trade ID " +
@ -110,7 +109,7 @@ public class DisputeValidation {
throw new NodeAddressException(dispute, msg);
}
}
public static void validateDonationAddress(Dispute dispute,
Transaction delayedPayoutTx,
NetworkParameters params)
@ -123,7 +122,7 @@ public class DisputeValidation {
log.error(delayedPayoutTx.toString());
throw new DisputeValidation.AddressException(dispute, errorMsg);
}
// Verify that address in the dispute matches the one in the trade.
String delayedPayoutTxOutputAddress = address.toString();
checkArgument(delayedPayoutTxOutputAddress.equals(dispute.getDonationAddressOfDelayedPayoutTx()),
@ -131,40 +130,40 @@ public class DisputeValidation {
"delayedPayoutTxOutputAddress=" + delayedPayoutTxOutputAddress +
"; dispute.getDonationAddressOfDelayedPayoutTx()=" + dispute.getDonationAddressOfDelayedPayoutTx());
}
public static void testIfAnyDisputeTriedReplay(List<Dispute> disputeList,
Consumer<DisputeReplayException> exceptionHandler) {
var tuple = getTestReplayHashMaps(disputeList);
Map<String, Set<String>> disputesPerTradeId = tuple.first;
Map<String, Set<String>> disputesPerDelayedPayoutTxId = tuple.second;
Map<String, Set<String>> disputesPerDepositTxId = tuple.third;
disputeList.forEach(disputeToTest -> {
try {
testIfDisputeTriesReplay(disputeToTest,
disputesPerTradeId,
disputesPerDelayedPayoutTxId,
disputesPerDepositTxId);
} catch (DisputeReplayException e) {
exceptionHandler.accept(e);
}
});
}
public static void testIfDisputeTriesReplay(Dispute dispute,
List<Dispute> disputeList) throws DisputeReplayException {
var tuple = getTestReplayHashMaps(disputeList);
Map<String, Set<String>> disputesPerTradeId = tuple.first;
Map<String, Set<String>> disputesPerDelayedPayoutTxId = tuple.second;
Map<String, Set<String>> disputesPerDepositTxId = tuple.third;
testIfDisputeTriesReplay(dispute,
disputesPerTradeId,
disputesPerDelayedPayoutTxId,
disputesPerDepositTxId);
}
private static Tuple3<Map<String, Set<String>>, Map<String, Set<String>>, Map<String, Set<String>>> getTestReplayHashMaps(
List<Dispute> disputeList) {
Map<String, Set<String>> disputesPerTradeId = new HashMap<>();

View file

@ -23,17 +23,15 @@ import haveno.common.util.Utilities;
import haveno.network.p2p.NodeAddress;
import haveno.network.p2p.storage.payload.ExpirablePayload;
import haveno.network.p2p.storage.payload.ProtectedStoragePayload;
import java.security.PublicKey;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
import java.security.PublicKey;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@EqualsAndHashCode
@Slf4j

View file

@ -17,8 +17,9 @@
package haveno.core.support.dispute.agent;
import lombok.extern.slf4j.Slf4j;
import haveno.core.locale.Res;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
@Slf4j

View file

@ -31,17 +31,16 @@ import haveno.network.p2p.NodeAddress;
import haveno.network.p2p.P2PService;
import haveno.network.p2p.storage.HashMapChangedListener;
import haveno.network.p2p.storage.payload.ProtectedStorageEntry;
import javafx.collections.FXCollections;
import javafx.collections.ObservableMap;
import lombok.extern.slf4j.Slf4j;
import org.bitcoinj.core.ECKey;
import org.bitcoinj.core.Utils;
import javafx.collections.FXCollections;
import javafx.collections.ObservableMap;
import javax.annotation.Nullable;
import java.math.BigInteger;
import java.security.PublicKey;
import java.security.SignatureException;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@ -51,10 +50,6 @@ import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
import static org.bitcoinj.core.Utils.HEX;
@Slf4j

View file

@ -26,13 +26,13 @@ import haveno.core.filter.FilterManager;
import haveno.network.p2p.NodeAddress;
import haveno.network.p2p.P2PService;
import haveno.network.p2p.storage.HashMapChangedListener;
import lombok.extern.slf4j.Slf4j;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import lombok.extern.slf4j.Slf4j;
/**
* Used to store disputeAgents profile and load map of disputeAgents
*/

View file

@ -30,6 +30,8 @@ import haveno.core.support.dispute.DisputeManager;
import haveno.core.support.dispute.DisputeResult;
import haveno.core.user.DontShowAgainLookup;
import javafx.collections.ListChangeListener;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.Collection;
@ -42,9 +44,6 @@ import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
/**
* Detects traders who had disputes where they used different account holder names. Only payment methods where a
* real name is required are used for the check.

View file

@ -23,13 +23,13 @@ import haveno.core.proto.CoreProtoResolver;
import haveno.core.support.SupportType;
import haveno.core.support.dispute.Dispute;
import haveno.core.support.dispute.DisputeList;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import static com.google.common.base.Preconditions.checkArgument;
@Slf4j

View file

@ -19,6 +19,7 @@ package haveno.core.support.dispute.arbitration;
import haveno.common.persistence.PersistenceManager;
import haveno.core.support.dispute.DisputeListService;
import javax.inject.Inject;
import javax.inject.Singleton;

View file

@ -17,6 +17,8 @@
package haveno.core.support.dispute.arbitration;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import common.utils.GenUtils;
import haveno.common.Timer;
import haveno.common.UserThread;
@ -32,8 +34,8 @@ import haveno.core.support.SupportType;
import haveno.core.support.dispute.Dispute;
import haveno.core.support.dispute.DisputeManager;
import haveno.core.support.dispute.DisputeResult;
import haveno.core.support.dispute.DisputeSummaryVerification;
import haveno.core.support.dispute.DisputeResult.Winner;
import haveno.core.support.dispute.DisputeSummaryVerification;
import haveno.core.support.dispute.arbitration.arbitrator.ArbitratorManager;
import haveno.core.support.dispute.messages.DisputeClosedMessage;
import haveno.core.support.dispute.messages.DisputeOpenedMessage;
@ -49,8 +51,12 @@ import haveno.core.xmr.wallet.XmrWalletService;
import haveno.network.p2p.AckMessageSourceType;
import haveno.network.p2p.NodeAddress;
import haveno.network.p2p.P2PService;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import monero.wallet.MoneroWallet;
import monero.wallet.model.MoneroDestination;
import monero.wallet.model.MoneroMultisigSignResult;
import monero.wallet.model.MoneroTxSet;
import monero.wallet.model.MoneroTxWallet;
import java.math.BigInteger;
import java.util.HashMap;
@ -60,18 +66,8 @@ import java.util.Map;
import java.util.Optional;
import java.util.Set;
import lombok.extern.slf4j.Slf4j;
import static com.google.common.base.Preconditions.checkNotNull;
import monero.wallet.MoneroWallet;
import monero.wallet.model.MoneroDestination;
import monero.wallet.model.MoneroMultisigSignResult;
import monero.wallet.model.MoneroTxSet;
import monero.wallet.model.MoneroTxWallet;
@Slf4j
@Singleton
public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeList> {
@ -199,17 +195,17 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
chatMessage = disputeResult.getChatMessage();
checkNotNull(chatMessage, "chatMessage must not be null");
String tradeId = disputeResult.getTradeId();
log.info("Processing {} for {} {}", disputeClosedMessage.getClass().getSimpleName(), trade.getClass().getSimpleName(), disputeResult.getTradeId());
// verify arbitrator signature
String summaryText = chatMessage.getMessage();
DisputeSummaryVerification.verifySignature(summaryText, arbitratorManager);
// save dispute closed message for reprocessing
trade.getProcessModel().setDisputeClosedMessage(disputeClosedMessage);
requestPersistence();
// get dispute
Optional<Dispute> disputeOptional = findDispute(disputeResult);
String uid = disputeClosedMessage.getUid();
@ -228,14 +224,14 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
return;
}
dispute = disputeOptional.get();
// verify that arbitrator does not get DisputeClosedMessage
if (keyRing.getPubKeyRing().equals(dispute.getAgentPubKeyRing())) {
log.error("Arbitrator received disputeResultMessage. That should never happen.");
trade.getProcessModel().setDisputeClosedMessage(null); // don't reprocess
return;
}
// set dispute state
cleanupRetryMap(uid);
if (!dispute.getChatMessages().contains(chatMessage)) {
@ -260,7 +256,7 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
if (disputeClosedMessage.getUpdatedMultisigHex() != null) trade.getArbitrator().setUpdatedMultisigHex(disputeClosedMessage.getUpdatedMultisigHex());
trade.importMultisigHex();
}
// attempt to sign and publish dispute payout tx if given and not already published
if (disputeClosedMessage.getUnsignedPayoutTxHex() != null && !trade.isPayoutPublished()) {
@ -270,14 +266,14 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
GenUtils.waitFor(Trade.DEFER_PUBLISH_MS);
if (!trade.isPayoutUnlocked()) trade.syncWallet();
}
// sign and publish dispute payout tx if peer still has not published
if (!trade.isPayoutPublished()) {
try {
log.info("Signing and publishing dispute payout tx for {} {}", trade.getClass().getSimpleName(), trade.getId());
signAndPublishDisputePayoutTx(trade);
} catch (Exception e) {
// check if payout published again
trade.syncWallet();
if (trade.isPayoutPublished()) {
@ -293,7 +289,7 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
if (trade.isPayoutPublished()) log.info("Dispute payout tx already published for {} {}", trade.getClass().getSimpleName(), trade.getId());
else if (disputeClosedMessage.getUnsignedPayoutTxHex() == null) log.info("{} did not receive unsigned dispute payout tx for trade {} because the arbitrator did not have their updated multisig info (can happen if trader went offline after trade started)", trade.getClass().getSimpleName(), trade.getId());
}
// We use the chatMessage as we only persist those not the DisputeClosedMessage.
// If we would use the DisputeClosedMessage we could not lookup for the msg when we receive the AckMessage.
sendAckMessage(chatMessage, dispute.getAgentPubKeyRing(), true, null);
@ -302,7 +298,7 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
log.warn("Error processing dispute closed message: " + e.getMessage());
e.printStackTrace();
requestPersistence();
// nack bad message and do not reprocess
if (e instanceof IllegalArgumentException) {
trade.getProcessModel().setPaymentReceivedMessage(null); // message is processed
@ -310,7 +306,7 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
requestPersistence();
throw e;
}
// schedule to reprocess message unless deleted
if (trade.getProcessModel().getDisputeClosedMessage() != null) {
if (!reprocessDisputeClosedMessageCounts.containsKey(trade.getId())) reprocessDisputeClosedMessageCounts.put(trade.getId(), 0);
@ -393,7 +389,7 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
BigInteger expectedLoserAmount = disputeResult.getWinner() == Winner.BUYER ? disputeResult.getSellerPayoutAmount() : disputeResult.getBuyerPayoutAmount();
// add any loss of precision to winner amount
expectedWinnerAmount = expectedWinnerAmount.add(trade.getWallet().getUnlockedBalance().subtract(expectedWinnerAmount.add(expectedLoserAmount)));
expectedWinnerAmount = expectedWinnerAmount.add(trade.getWallet().getUnlockedBalance().subtract(expectedWinnerAmount.add(expectedLoserAmount)));
// winner pays cost if loser gets nothing, otherwise loser pays cost
if (expectedLoserAmount.equals(BigInteger.ZERO)) expectedWinnerAmount = expectedWinnerAmount.subtract(txCost);
@ -424,7 +420,7 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
disputeTxSet.setMultisigTxHex(signedMultisigTxHex);
trade.setPayoutTxHex(signedMultisigTxHex);
requestPersistence();
// verify mining fee is within tolerance by recreating payout tx
// TODO (monero-project): creating tx will require exchanging updated multisig hex if message needs reprocessed. provide weight with describe_transfer so fee can be estimated?
MoneroTxWallet feeEstimateTx = null;

View file

@ -17,9 +17,10 @@
package haveno.core.support.dispute.arbitration;
import lombok.extern.slf4j.Slf4j;
import haveno.core.support.dispute.Dispute;
import haveno.core.support.dispute.DisputeSession;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
@Slf4j

View file

@ -19,12 +19,12 @@ package haveno.core.support.dispute.arbitration;
import haveno.core.account.witness.AccountAgeWitness;
import haveno.core.payment.payload.PaymentAccountPayload;
import java.math.BigInteger;
import java.security.PublicKey;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import java.math.BigInteger;
import java.security.PublicKey;
// TODO consider to move to signed witness domain
@Getter
@EqualsAndHashCode(onlyExplicitlyIncluded = true)

View file

@ -23,16 +23,15 @@ import haveno.common.proto.ProtoUtil;
import haveno.common.util.CollectionUtils;
import haveno.core.support.dispute.agent.DisputeAgent;
import haveno.network.p2p.NodeAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@EqualsAndHashCode(callSuper = true)
@Slf4j

View file

@ -23,13 +23,13 @@ import haveno.core.filter.FilterManager;
import haveno.core.support.dispute.agent.DisputeAgentManager;
import haveno.core.user.User;
import haveno.network.p2p.storage.payload.ProtectedStorageEntry;
import lombok.extern.slf4j.Slf4j;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.ArrayList;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Singleton
public class ArbitratorManager extends DisputeAgentManager<Arbitrator> {

View file

@ -22,8 +22,8 @@ import haveno.core.filter.FilterManager;
import haveno.core.support.dispute.agent.DisputeAgentService;
import haveno.network.p2p.NodeAddress;
import haveno.network.p2p.P2PService;
import javax.inject.Inject;
import javax.inject.Inject;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

View file

@ -23,13 +23,13 @@ import haveno.core.proto.CoreProtoResolver;
import haveno.core.support.SupportType;
import haveno.core.support.dispute.Dispute;
import haveno.core.support.dispute.DisputeList;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@ToString
/*

View file

@ -19,6 +19,7 @@ package haveno.core.support.dispute.mediation;
import haveno.common.persistence.PersistenceManager;
import haveno.core.support.dispute.DisputeListService;
import javax.inject.Inject;
import javax.inject.Singleton;

View file

@ -50,12 +50,11 @@ import haveno.core.xmr.wallet.XmrWalletService;
import haveno.network.p2p.AckMessageSourceType;
import haveno.network.p2p.NodeAddress;
import haveno.network.p2p.P2PService;
import java.math.BigInteger;
import java.util.Optional;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
import java.math.BigInteger;
import java.util.Optional;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;

View file

@ -17,9 +17,10 @@
package haveno.core.support.dispute.mediation;
import lombok.extern.slf4j.Slf4j;
import haveno.core.support.dispute.Dispute;
import haveno.core.support.dispute.DisputeSession;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
@Slf4j

View file

@ -23,15 +23,14 @@ import haveno.common.proto.ProtoUtil;
import haveno.common.util.CollectionUtils;
import haveno.core.support.dispute.agent.DisputeAgent;
import haveno.network.p2p.NodeAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@EqualsAndHashCode(callSuper = true)
@Slf4j

View file

@ -22,10 +22,9 @@ import haveno.core.filter.FilterManager;
import haveno.core.support.dispute.agent.DisputeAgentManager;
import haveno.core.user.User;
import haveno.network.p2p.storage.payload.ProtectedStorageEntry;
import javax.inject.Singleton;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.List;
@Singleton

View file

@ -22,16 +22,15 @@ import haveno.core.filter.FilterManager;
import haveno.core.support.dispute.agent.DisputeAgentService;
import haveno.network.p2p.NodeAddress;
import haveno.network.p2p.P2PService;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import javax.inject.Inject;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Singleton

View file

@ -25,11 +25,10 @@ import haveno.network.p2p.NodeAddress;
import lombok.EqualsAndHashCode;
import lombok.Value;
import static com.google.common.base.Preconditions.checkArgument;
import javax.annotation.Nullable;
import java.util.Optional;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkArgument;
@Value
@EqualsAndHashCode(callSuper = true)

View file

@ -19,6 +19,7 @@ package haveno.core.support.dispute.messages;
import haveno.core.support.SupportType;
import haveno.core.support.messages.SupportMessage;
import java.util.concurrent.TimeUnit;
public abstract class DisputeMessage extends SupportMessage {

View file

@ -23,10 +23,11 @@ import haveno.core.support.SupportType;
import haveno.core.support.dispute.Dispute;
import haveno.core.trade.messages.PaymentSentMessage;
import haveno.network.p2p.NodeAddress;
import java.util.Optional;
import lombok.EqualsAndHashCode;
import lombok.Value;
import java.util.Optional;
@EqualsAndHashCode(callSuper = true)
@Value
public final class DisputeOpenedMessage extends DisputeMessage {

View file

@ -23,13 +23,13 @@ import haveno.core.proto.CoreProtoResolver;
import haveno.core.support.SupportType;
import haveno.core.support.dispute.Dispute;
import haveno.core.support.dispute.DisputeList;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import static com.google.common.base.Preconditions.checkArgument;
@Slf4j

View file

@ -19,6 +19,7 @@ package haveno.core.support.dispute.refund;
import haveno.common.persistence.PersistenceManager;
import haveno.core.support.dispute.DisputeListService;
import javax.inject.Inject;
import javax.inject.Singleton;

View file

@ -46,11 +46,10 @@ import haveno.core.xmr.wallet.XmrWalletService;
import haveno.network.p2p.AckMessageSourceType;
import haveno.network.p2p.NodeAddress;
import haveno.network.p2p.P2PService;
import java.util.Optional;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
import java.util.Optional;
import static com.google.common.base.Preconditions.checkNotNull;

View file

@ -17,9 +17,10 @@
package haveno.core.support.dispute.refund;
import lombok.extern.slf4j.Slf4j;
import haveno.core.support.dispute.Dispute;
import haveno.core.support.dispute.DisputeSession;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
@Slf4j

View file

@ -26,16 +26,15 @@ import haveno.common.util.CollectionUtils;
import haveno.core.support.dispute.agent.DisputeAgent;
import haveno.network.p2p.NodeAddress;
import haveno.network.p2p.storage.payload.CapabilityRequiringPayload;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@EqualsAndHashCode(callSuper = true)
@Slf4j

View file

@ -22,13 +22,12 @@ import haveno.core.filter.FilterManager;
import haveno.core.support.dispute.agent.DisputeAgentManager;
import haveno.core.user.User;
import haveno.network.p2p.storage.payload.ProtectedStorageEntry;
import lombok.extern.slf4j.Slf4j;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Singleton
public class RefundAgentManager extends DisputeAgentManager<RefundAgent> {

View file

@ -22,8 +22,8 @@ import haveno.core.filter.FilterManager;
import haveno.core.support.dispute.agent.DisputeAgentService;
import haveno.network.p2p.NodeAddress;
import haveno.network.p2p.P2PService;
import javax.inject.Inject;
import javax.inject.Inject;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

View file

@ -30,7 +30,13 @@ import javafx.beans.property.ReadOnlyStringProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -39,15 +45,6 @@ import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.lang.ref.WeakReference;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
/* Message for direct communication between two nodes. Originally built for trader to
* arbitrator communication as no other direct communication was allowed. Arbitrator is
* considered as the server and trader as the client in arbitration chats

View file

@ -22,7 +22,6 @@ import haveno.core.support.messages.ChatMessage;
import haveno.core.trade.Trade;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;

View file

@ -31,16 +31,14 @@ import haveno.core.trade.TradeManager;
import haveno.network.p2p.AckMessageSourceType;
import haveno.network.p2p.NodeAddress;
import haveno.network.p2p.P2PService;
import javafx.collections.ObservableList;
import lombok.extern.slf4j.Slf4j;
import javax.inject.Inject;
import javax.inject.Singleton;
import javafx.collections.ObservableList;
import java.util.List;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Singleton
public class TraderChatManager extends SupportManager {