mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-26 08:25:23 -04:00
Use PopupManager for queuing popups, improve version handling, deactivate focus requests, add popup when getting disconnection because of version conflict
This commit is contained in:
parent
ba4a228fed
commit
a264fa4e0b
94 changed files with 421 additions and 288 deletions
|
@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
public final class Alert implements PubKeyProtectedExpirablePayload {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
private static final long TTL = TimeUnit.DAYS.toMillis(10);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
public final class Arbitrator implements PubKeyProtectedExpirablePayload {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
public static final long TTL = TimeUnit.DAYS.toMillis(10);
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ import java.util.List;
|
|||
|
||||
public class Dispute implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
private static final Logger log = LoggerFactory.getLogger(Dispute.class);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -32,7 +32,7 @@ import java.util.Date;
|
|||
|
||||
public class DisputeResult implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
private static final Logger log = LoggerFactory.getLogger(DisputeResult.class);
|
||||
|
||||
public enum FeePaymentPolicy {
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.util.List;
|
|||
|
||||
public final class DisputeDirectMessage extends DisputeMessage {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
private static final Logger log = LoggerFactory.getLogger(DisputeDirectMessage.class);
|
||||
|
||||
private final long date;
|
||||
|
@ -188,7 +188,7 @@ public final class DisputeDirectMessage extends DisputeMessage {
|
|||
|
||||
public static class Attachment implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
private static final Logger log = LoggerFactory.getLogger(Attachment.class);
|
||||
|
||||
private final byte[] bytes;
|
||||
|
|
|
@ -21,10 +21,10 @@ import io.bitsquare.app.Version;
|
|||
import io.bitsquare.p2p.messaging.MailboxMessage;
|
||||
|
||||
public abstract class DisputeMessage implements MailboxMessage {
|
||||
private final int networkId = Version.getNetworkId();
|
||||
private final int messageVersion = Version.getP2PMessageVersion();
|
||||
|
||||
@Override
|
||||
public int networkId() {
|
||||
return networkId;
|
||||
public int getMessageVersion() {
|
||||
return messageVersion;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import io.bitsquare.p2p.NodeAddress;
|
|||
|
||||
public final class DisputeResultMessage extends DisputeMessage {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
public final DisputeResult disputeResult;
|
||||
private final NodeAddress myNodeAddress;
|
||||
|
|
|
@ -23,7 +23,7 @@ import io.bitsquare.p2p.NodeAddress;
|
|||
|
||||
public final class OpenNewDisputeMessage extends DisputeMessage {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
public final Dispute dispute;
|
||||
private final NodeAddress myNodeAddress;
|
||||
|
|
|
@ -23,7 +23,7 @@ import io.bitsquare.p2p.NodeAddress;
|
|||
|
||||
public final class PeerOpenedDisputeMessage extends DisputeMessage {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
public final Dispute dispute;
|
||||
private final NodeAddress myNodeAddress;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.Arrays;
|
|||
|
||||
public final class PeerPublishedPayoutTxMessage extends DisputeMessage {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
public final byte[] transaction;
|
||||
public final String tradeId;
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.Arrays;
|
|||
|
||||
public class RawInput implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
public final long index;
|
||||
public final byte[] parentTransaction;
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.io.Serializable;
|
|||
|
||||
public class AliPayAccountContractData extends PaymentAccountContractData implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
private String accountNr;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.io.Serializable;
|
|||
|
||||
public class BlockChainAccountContractData extends PaymentAccountContractData implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
private String address;
|
||||
// used in crypto note coins. not supported now but hopefully in future, so leave it for now.
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.io.Serializable;
|
|||
|
||||
public class OKPayAccountContractData extends PaymentAccountContractData implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
private String accountNr;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.io.Serializable;
|
|||
|
||||
public abstract class PaymentAccountContractData implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
private final String paymentMethodName;
|
||||
private final String id;
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.io.Serializable;
|
|||
|
||||
public class PerfectMoneyAccountContractData extends PaymentAccountContractData implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
private String accountNr;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
public class SepaAccountContractData extends PaymentAccountContractData implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SepaAccountContractData.class);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.io.Serializable;
|
|||
|
||||
public class SwishAccountContractData extends PaymentAccountContractData implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
private String mobileNr;
|
||||
private String holderName;
|
||||
|
|
|
@ -36,7 +36,7 @@ import static com.google.common.base.Preconditions.checkArgument;
|
|||
public class Contract implements Serializable {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
@JsonExclude
|
||||
public static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
public static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
public final Offer offer;
|
||||
private final long tradeAmount;
|
||||
|
|
|
@ -49,7 +49,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
public final class Offer implements PubKeyProtectedExpirablePayload {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
@JsonExclude
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
@JsonExclude
|
||||
private static final Logger log = LoggerFactory.getLogger(Offer.class);
|
||||
|
||||
|
@ -58,7 +58,6 @@ public final class Offer implements PubKeyProtectedExpirablePayload {
|
|||
"take that offer.";
|
||||
public static final String TAC_TAKER = "With taking the offer I commit to the trade conditions as defined.";
|
||||
|
||||
|
||||
public enum Direction {BUY, SELL}
|
||||
|
||||
public enum State {
|
||||
|
@ -71,12 +70,11 @@ public final class Offer implements PubKeyProtectedExpirablePayload {
|
|||
}
|
||||
|
||||
|
||||
// key attributes for lookup
|
||||
private final String id;
|
||||
private final Direction direction;
|
||||
private final String currencyCode;
|
||||
private final long date;
|
||||
|
||||
private final long protocolVersion;
|
||||
private final long fiatPrice;
|
||||
private final long amount;
|
||||
private final long minAmount;
|
||||
|
@ -138,6 +136,8 @@ public final class Offer implements PubKeyProtectedExpirablePayload {
|
|||
this.arbitratorNodeAddresses = arbitratorNodeAddresses;
|
||||
this.acceptedCountryCodes = acceptedCountryCodes;
|
||||
|
||||
protocolVersion = Version.TRADE_PROTOCOL_VERSION;
|
||||
|
||||
date = new Date().getTime();
|
||||
setState(State.UNDEFINED);
|
||||
}
|
||||
|
@ -258,6 +258,9 @@ public final class Offer implements PubKeyProtectedExpirablePayload {
|
|||
return pubKeyRing.getSignaturePubKey();
|
||||
}
|
||||
|
||||
public long getProtocolVersion() {
|
||||
return protocolVersion;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
|
|
|
@ -22,7 +22,7 @@ import io.bitsquare.common.crypto.PubKeyRing;
|
|||
|
||||
public final class OfferAvailabilityRequest extends OfferMessage {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
private final PubKeyRing pubKeyRing;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import io.bitsquare.app.Version;
|
|||
|
||||
public final class OfferAvailabilityResponse extends OfferMessage {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
public final boolean isAvailable;
|
||||
|
||||
|
|
|
@ -25,9 +25,9 @@ import javax.annotation.concurrent.Immutable;
|
|||
@Immutable
|
||||
public abstract class OfferMessage implements DirectMessage {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
private final int networkId = Version.getNetworkId();
|
||||
private final int messageVersion = Version.getP2PMessageVersion();
|
||||
public final String offerId;
|
||||
|
||||
protected OfferMessage(String offerId) {
|
||||
|
@ -35,14 +35,14 @@ public abstract class OfferMessage implements DirectMessage {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int networkId() {
|
||||
return networkId;
|
||||
public int getMessageVersion() {
|
||||
return messageVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OfferMessage{" +
|
||||
"networkId=" + networkId +
|
||||
"messageVersion=" + messageVersion +
|
||||
", offerId='" + offerId + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import java.util.Arrays;
|
|||
@Immutable
|
||||
public final class DepositTxPublishedMessage extends TradeMessage implements MailboxMessage {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
public final byte[] depositTx;
|
||||
private final NodeAddress senderNodeAddress;
|
||||
|
|
|
@ -26,7 +26,7 @@ import javax.annotation.concurrent.Immutable;
|
|||
@Immutable
|
||||
public final class FiatTransferStartedMessage extends TradeMessage implements MailboxMessage {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
public final String buyerPayoutAddress;
|
||||
private final NodeAddress senderNodeAddress;
|
||||
|
|
|
@ -27,7 +27,7 @@ import java.util.Arrays;
|
|||
@Immutable
|
||||
public final class FinalizePayoutTxRequest extends TradeMessage implements MailboxMessage {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
public final byte[] sellerSignature;
|
||||
public final String sellerPayoutAddress;
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.util.List;
|
|||
@Immutable
|
||||
public final class PayDepositRequest extends TradeMessage implements MailboxMessage {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
public final long tradeAmount;
|
||||
public final byte[] takerTradeWalletPubKey;
|
||||
|
|
|
@ -27,7 +27,7 @@ import java.util.Arrays;
|
|||
@Immutable
|
||||
public final class PayoutTxFinalizedMessage extends TradeMessage implements MailboxMessage {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
public final byte[] payoutTx;
|
||||
private final NodeAddress senderNodeAddress;
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.util.List;
|
|||
@Immutable
|
||||
public final class PublishDepositTxRequest extends TradeMessage {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(PublishDepositTxRequest.class);
|
||||
|
||||
|
|
|
@ -25,9 +25,9 @@ import javax.annotation.concurrent.Immutable;
|
|||
@Immutable
|
||||
public abstract class TradeMessage implements DirectMessage {
|
||||
// That object is sent over the wire, so we need to take care of version compatibility.
|
||||
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
|
||||
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
|
||||
|
||||
private final int networkId = Version.getNetworkId();
|
||||
private final int messageVersion = Version.getP2PMessageVersion();
|
||||
public final String tradeId;
|
||||
|
||||
@Override
|
||||
|
@ -51,7 +51,7 @@ public abstract class TradeMessage implements DirectMessage {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int networkId() {
|
||||
return networkId;
|
||||
public int getMessageVersion() {
|
||||
return messageVersion;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue