Change network version to avoid connecting to bisq nodes (#275)

Co-authored-by: l0nelyc0w <coinrunner@danwin1210.me>
This commit is contained in:
woodser 2022-04-04 14:17:44 -04:00 committed by GitHub
parent 435051f204
commit 00765d7b32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
70 changed files with 142 additions and 135 deletions

View file

@ -85,7 +85,7 @@ public class Version {
// If objects are used for both network and database the network version is applied. // If objects are used for both network and database the network version is applied.
// VERSION = 0.5.0 -> P2P_NETWORK_VERSION = 1 // VERSION = 0.5.0 -> P2P_NETWORK_VERSION = 1
// With version 1.2.2 we change to version 2 (new trade protocol) // With version 1.2.2 we change to version 2 (new trade protocol)
public static final int P2P_NETWORK_VERSION = 1; public static final String P2P_NETWORK_VERSION = "A";
// The version no. of the serialized data stored to disc. A change will break the serialization of old objects. // The version no. of the serialized data stored to disc. A change will break the serialization of old objects.
// VERSION = 0.5.0 -> LOCAL_DB_VERSION = 1 // VERSION = 0.5.0 -> LOCAL_DB_VERSION = 1
@ -100,9 +100,9 @@ public class Version {
// Version 1.2.2 -> TRADE_PROTOCOL_VERSION = 2 // Version 1.2.2 -> TRADE_PROTOCOL_VERSION = 2
// Version 1.5.0 -> TRADE_PROTOCOL_VERSION = 3 // Version 1.5.0 -> TRADE_PROTOCOL_VERSION = 3
public static final int TRADE_PROTOCOL_VERSION = 3; public static final int TRADE_PROTOCOL_VERSION = 3;
private static int p2pMessageVersion; private static String p2pMessageVersion;
public static int getP2PMessageVersion() { public static String getP2PMessageVersion() {
return p2pMessageVersion; return p2pMessageVersion;
} }
@ -114,7 +114,12 @@ public class Version {
// CRYPTO_NETWORK_ID is ordinal of enum. We use for changes at NETWORK_PROTOCOL_VERSION a multiplication with 10 // CRYPTO_NETWORK_ID is ordinal of enum. We use for changes at NETWORK_PROTOCOL_VERSION a multiplication with 10
// to not mix up networks: // to not mix up networks:
p2pMessageVersion = BASE_CURRENCY_NETWORK + 10 * P2P_NETWORK_VERSION; if (BASE_CURRENCY_NETWORK == 0)
p2pMessageVersion = "0" + P2P_NETWORK_VERSION;
if (BASE_CURRENCY_NETWORK == 1)
p2pMessageVersion = "1" + P2P_NETWORK_VERSION;
if (BASE_CURRENCY_NETWORK == 2)
p2pMessageVersion = "2" + P2P_NETWORK_VERSION;
} }
public static int getBaseCurrencyNetwork() { public static int getBaseCurrencyNetwork() {

View file

@ -28,14 +28,14 @@ import static com.google.common.base.Preconditions.checkArgument;
@EqualsAndHashCode @EqualsAndHashCode
public abstract class NetworkEnvelope implements Envelope { public abstract class NetworkEnvelope implements Envelope {
protected final int messageVersion; protected final String messageVersion;
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// PROTO BUFFER // PROTO BUFFER
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
protected NetworkEnvelope(int messageVersion) { protected NetworkEnvelope(String messageVersion) {
this.messageVersion = messageVersion; this.messageVersion = messageVersion;
} }
@ -57,10 +57,10 @@ public abstract class NetworkEnvelope implements Envelope {
// API // API
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
public int getMessageVersion() { public String getMessageVersion() {
// -1 is used for the case that we use an envelope message as payload (mailbox) // -1 is used for the case that we use an envelope message as payload (mailbox)
// so we check only against 0 which is the default value if not set // so we check only against 0 which is the default value if not set
checkArgument(messageVersion != 0, "messageVersion is not set (0)."); checkArgument(!messageVersion.equals("0"), "messageVersion is not set (0).");
return messageVersion; return messageVersion;
} }

View file

@ -51,7 +51,7 @@ public class PrivateNotificationMessage extends NetworkEnvelope implements Mailb
private PrivateNotificationMessage(PrivateNotificationPayload privateNotificationPayload, private PrivateNotificationMessage(PrivateNotificationPayload privateNotificationPayload,
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
String uid, String uid,
int messageVersion) { String messageVersion) {
super(messageVersion); super(messageVersion);
this.privateNotificationPayload = privateNotificationPayload; this.privateNotificationPayload = privateNotificationPayload;
this.senderNodeAddress = senderNodeAddress; this.senderNodeAddress = senderNodeAddress;
@ -68,7 +68,7 @@ public class PrivateNotificationMessage extends NetworkEnvelope implements Mailb
.build(); .build();
} }
public static PrivateNotificationMessage fromProto(protobuf.PrivateNotificationMessage proto, int messageVersion) { public static PrivateNotificationMessage fromProto(protobuf.PrivateNotificationMessage proto, String messageVersion) {
return new PrivateNotificationMessage(PrivateNotificationPayload.fromProto(proto.getPrivateNotificationPayload()), return new PrivateNotificationMessage(PrivateNotificationPayload.fromProto(proto.getPrivateNotificationPayload()),
NodeAddress.fromProto(proto.getSenderNodeAddress()), NodeAddress.fromProto(proto.getSenderNodeAddress()),
proto.getUid(), proto.getUid(),

View file

@ -39,7 +39,7 @@ public class GetInventoryRequest extends NetworkEnvelope {
// PROTO BUFFER // PROTO BUFFER
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private GetInventoryRequest(String version, int messageVersion) { private GetInventoryRequest(String version, String messageVersion) {
super(messageVersion); super(messageVersion);
this.version = version; this.version = version;
@ -53,7 +53,7 @@ public class GetInventoryRequest extends NetworkEnvelope {
.build(); .build();
} }
public static GetInventoryRequest fromProto(protobuf.GetInventoryRequest proto, int messageVersion) { public static GetInventoryRequest fromProto(protobuf.GetInventoryRequest proto, String messageVersion) {
return new GetInventoryRequest(proto.getVersion(), messageVersion); return new GetInventoryRequest(proto.getVersion(), messageVersion);
} }
} }

View file

@ -46,7 +46,7 @@ public class GetInventoryResponse extends NetworkEnvelope {
// PROTO BUFFER // PROTO BUFFER
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private GetInventoryResponse(Map<InventoryItem, String> inventory, int messageVersion) { private GetInventoryResponse(Map<InventoryItem, String> inventory, String messageVersion) {
super(messageVersion); super(messageVersion);
this.inventory = inventory; this.inventory = inventory;
@ -63,7 +63,7 @@ public class GetInventoryResponse extends NetworkEnvelope {
.build(); .build();
} }
public static GetInventoryResponse fromProto(protobuf.GetInventoryResponse proto, int messageVersion) { public static GetInventoryResponse fromProto(protobuf.GetInventoryResponse proto, String messageVersion) {
// For protobuf we use a map with a string key // For protobuf we use a map with a string key
Map<String, String> map = proto.getInventoryMap(); Map<String, String> map = proto.getInventoryMap();
Map<InventoryItem, String> inventory = new HashMap<>(); Map<InventoryItem, String> inventory = new HashMap<>();

View file

@ -71,7 +71,7 @@ public final class OfferAvailabilityRequest extends OfferMessage implements Supp
long takersTradePrice, long takersTradePrice,
boolean isTakerApiUser, boolean isTakerApiUser,
@Nullable Capabilities supportedCapabilities, @Nullable Capabilities supportedCapabilities,
int messageVersion, String messageVersion,
@Nullable String uid, @Nullable String uid,
InitTradeRequest tradeRequest) { InitTradeRequest tradeRequest) {
super(messageVersion, offerId, uid); super(messageVersion, offerId, uid);
@ -108,7 +108,7 @@ public final class OfferAvailabilityRequest extends OfferMessage implements Supp
.build(); .build();
} }
public static OfferAvailabilityRequest fromProto(protobuf.OfferAvailabilityRequest proto, CoreProtoResolver coreProtoResolver, int messageVersion) { public static OfferAvailabilityRequest fromProto(protobuf.OfferAvailabilityRequest proto, CoreProtoResolver coreProtoResolver, String messageVersion) {
return new OfferAvailabilityRequest(proto.getOfferId(), return new OfferAvailabilityRequest(proto.getOfferId(),
PubKeyRing.fromProto(proto.getPubKeyRing()), PubKeyRing.fromProto(proto.getPubKeyRing()),
proto.getTakersTradePrice(), proto.getTakersTradePrice(),

View file

@ -69,7 +69,7 @@ public final class OfferAvailabilityResponse extends OfferMessage implements Sup
private OfferAvailabilityResponse(String offerId, private OfferAvailabilityResponse(String offerId,
AvailabilityResult availabilityResult, AvailabilityResult availabilityResult,
@Nullable Capabilities supportedCapabilities, @Nullable Capabilities supportedCapabilities,
int messageVersion, String messageVersion,
@Nullable String uid, @Nullable String uid,
String makerSignature, String makerSignature,
NodeAddress arbitratorNodeAddress) { NodeAddress arbitratorNodeAddress) {
@ -96,7 +96,7 @@ public final class OfferAvailabilityResponse extends OfferMessage implements Sup
.build(); .build();
} }
public static OfferAvailabilityResponse fromProto(protobuf.OfferAvailabilityResponse proto, int messageVersion) { public static OfferAvailabilityResponse fromProto(protobuf.OfferAvailabilityResponse proto, String messageVersion) {
return new OfferAvailabilityResponse(proto.getOfferId(), return new OfferAvailabilityResponse(proto.getOfferId(),
ProtoUtil.enumFromProto(AvailabilityResult.class, proto.getAvailabilityResult().name()), ProtoUtil.enumFromProto(AvailabilityResult.class, proto.getAvailabilityResult().name()),
Capabilities.fromIntList(proto.getSupportedCapabilitiesList()), Capabilities.fromIntList(proto.getSupportedCapabilitiesList()),

View file

@ -38,7 +38,7 @@ public abstract class OfferMessage extends NetworkEnvelope implements DirectMess
@Nullable @Nullable
protected final String uid; protected final String uid;
protected OfferMessage(int messageVersion, String offerId, @Nullable String uid) { protected OfferMessage(String messageVersion, String offerId, @Nullable String uid) {
super(messageVersion); super(messageVersion);
this.offerId = offerId; this.offerId = offerId;
this.uid = uid; this.uid = uid;

View file

@ -46,7 +46,7 @@ public final class SignOfferRequest extends OfferMessage implements DirectMessag
String senderAccountId, String senderAccountId,
OfferPayload offerPayload, OfferPayload offerPayload,
String uid, String uid,
int messageVersion, String messageVersion,
long currentDate, long currentDate,
String reserveTxHash, String reserveTxHash,
String reserveTxHex, String reserveTxHex,
@ -91,7 +91,7 @@ public final class SignOfferRequest extends OfferMessage implements DirectMessag
} }
public static SignOfferRequest fromProto(protobuf.SignOfferRequest proto, public static SignOfferRequest fromProto(protobuf.SignOfferRequest proto,
int messageVersion) { String messageVersion) {
return new SignOfferRequest(proto.getOfferId(), return new SignOfferRequest(proto.getOfferId(),
NodeAddress.fromProto(proto.getSenderNodeAddress()), NodeAddress.fromProto(proto.getSenderNodeAddress()),
PubKeyRing.fromProto(proto.getPubKeyRing()), PubKeyRing.fromProto(proto.getPubKeyRing()),

View file

@ -29,7 +29,7 @@ public final class SignOfferResponse extends OfferMessage implements DirectMessa
public SignOfferResponse(String offerId, public SignOfferResponse(String offerId,
String uid, String uid,
int messageVersion, String messageVersion,
OfferPayload signedOfferPayload) { OfferPayload signedOfferPayload) {
super(messageVersion, offerId, uid); super(messageVersion, offerId, uid);
this.signedOfferPayload = signedOfferPayload; this.signedOfferPayload = signedOfferPayload;
@ -51,7 +51,7 @@ public final class SignOfferResponse extends OfferMessage implements DirectMessa
} }
public static SignOfferResponse fromProto(protobuf.SignOfferResponse proto, public static SignOfferResponse fromProto(protobuf.SignOfferResponse proto,
int messageVersion) { String messageVersion) {
return new SignOfferResponse(proto.getOfferId(), return new SignOfferResponse(proto.getOfferId(),
proto.getUid(), proto.getUid(),
messageVersion, messageVersion,

View file

@ -106,7 +106,7 @@ public class CoreNetworkProtoResolver extends CoreProtoResolver implements Netwo
@Override @Override
public NetworkEnvelope fromProto(protobuf.NetworkEnvelope proto) throws ProtobufferException { public NetworkEnvelope fromProto(protobuf.NetworkEnvelope proto) throws ProtobufferException {
if (proto != null) { if (proto != null) {
final int messageVersion = proto.getMessageVersion(); final String messageVersion = proto.getMessageVersion();
switch (proto.getMessageCase()) { switch (proto.getMessageCase()) {
case PRELIMINARY_GET_DATA_REQUEST: case PRELIMINARY_GET_DATA_REQUEST:
return PreliminaryGetDataRequest.fromProto(proto.getPreliminaryGetDataRequest(), messageVersion); return PreliminaryGetDataRequest.fromProto(proto.getPreliminaryGetDataRequest(), messageVersion);

View file

@ -21,7 +21,7 @@ import bisq.core.support.SupportType;
import bisq.core.support.dispute.messages.DisputeMessage; import bisq.core.support.dispute.messages.DisputeMessage;
abstract class ArbitrationMessage extends DisputeMessage { abstract class ArbitrationMessage extends DisputeMessage {
ArbitrationMessage(int messageVersion, String uid, SupportType supportType) { ArbitrationMessage(String messageVersion, String uid, SupportType supportType) {
super(messageVersion, uid, supportType); super(messageVersion, uid, supportType);
} }
} }

View file

@ -59,7 +59,7 @@ public final class PeerPublishedDisputePayoutTxMessage extends ArbitrationMessag
String tradeId, String tradeId,
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
String uid, String uid,
int messageVersion, String messageVersion,
SupportType supportType) { SupportType supportType) {
super(messageVersion, uid, supportType); super(messageVersion, uid, supportType);
this.updatedMultisigHex = updatedMultisigHex; this.updatedMultisigHex = updatedMultisigHex;
@ -82,7 +82,7 @@ public final class PeerPublishedDisputePayoutTxMessage extends ArbitrationMessag
} }
public static PeerPublishedDisputePayoutTxMessage fromProto(protobuf.PeerPublishedDisputePayoutTxMessage proto, public static PeerPublishedDisputePayoutTxMessage fromProto(protobuf.PeerPublishedDisputePayoutTxMessage proto,
int messageVersion) { String messageVersion) {
return new PeerPublishedDisputePayoutTxMessage(proto.getUpdatedMultisigHex(), return new PeerPublishedDisputePayoutTxMessage(proto.getUpdatedMultisigHex(),
proto.getPayoutTxHex(), proto.getPayoutTxHex(),
proto.getTradeId(), proto.getTradeId(),

View file

@ -56,7 +56,7 @@ public final class ArbitratorPayoutTxRequest extends DisputeMessage {
private ArbitratorPayoutTxRequest(Dispute dispute, private ArbitratorPayoutTxRequest(Dispute dispute,
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
String uid, String uid,
int messageVersion, String messageVersion,
SupportType supportType, SupportType supportType,
String updatedMultisigHex) { String updatedMultisigHex) {
super(messageVersion, uid, supportType); super(messageVersion, uid, supportType);
@ -79,7 +79,7 @@ public final class ArbitratorPayoutTxRequest extends DisputeMessage {
public static ArbitratorPayoutTxRequest fromProto(protobuf.ArbitratorPayoutTxRequest proto, public static ArbitratorPayoutTxRequest fromProto(protobuf.ArbitratorPayoutTxRequest proto,
CoreProtoResolver coreProtoResolver, CoreProtoResolver coreProtoResolver,
int messageVersion) { String messageVersion) {
return new ArbitratorPayoutTxRequest(Dispute.fromProto(proto.getDispute(), coreProtoResolver), return new ArbitratorPayoutTxRequest(Dispute.fromProto(proto.getDispute(), coreProtoResolver),
NodeAddress.fromProto(proto.getSenderNodeAddress()), NodeAddress.fromProto(proto.getSenderNodeAddress()),
proto.getUid(), proto.getUid(),

View file

@ -55,7 +55,7 @@ public final class ArbitratorPayoutTxResponse extends DisputeMessage {
private ArbitratorPayoutTxResponse(String tradeId, private ArbitratorPayoutTxResponse(String tradeId,
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
String uid, String uid,
int messageVersion, String messageVersion,
SupportType supportType, SupportType supportType,
String arbitratorSignedPayoutTxHex) { String arbitratorSignedPayoutTxHex) {
super(messageVersion, uid, supportType); super(messageVersion, uid, supportType);
@ -78,7 +78,7 @@ public final class ArbitratorPayoutTxResponse extends DisputeMessage {
public static ArbitratorPayoutTxResponse fromProto(protobuf.ArbitratorPayoutTxResponse proto, public static ArbitratorPayoutTxResponse fromProto(protobuf.ArbitratorPayoutTxResponse proto,
CoreProtoResolver coreProtoResolver, CoreProtoResolver coreProtoResolver,
int messageVersion) { String messageVersion) {
return new ArbitratorPayoutTxResponse(proto.getTradeId(), return new ArbitratorPayoutTxResponse(proto.getTradeId(),
NodeAddress.fromProto(proto.getSenderNodeAddress()), NodeAddress.fromProto(proto.getSenderNodeAddress()),
proto.getUid(), proto.getUid(),

View file

@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit;
public abstract class DisputeMessage extends SupportMessage { public abstract class DisputeMessage extends SupportMessage {
public static final long TTL = TimeUnit.DAYS.toMillis(15); public static final long TTL = TimeUnit.DAYS.toMillis(15);
public DisputeMessage(int messageVersion, String uid, SupportType supportType) { public DisputeMessage(String messageVersion, String uid, SupportType supportType) {
super(messageVersion, uid, supportType); super(messageVersion, uid, supportType);
} }

View file

@ -54,7 +54,7 @@ public final class DisputeResultMessage extends DisputeMessage {
private DisputeResultMessage(DisputeResult disputeResult, private DisputeResultMessage(DisputeResult disputeResult,
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
String uid, String uid,
int messageVersion, String messageVersion,
SupportType supportType) { SupportType supportType) {
super(messageVersion, uid, supportType); super(messageVersion, uid, supportType);
this.disputeResult = disputeResult; this.disputeResult = disputeResult;
@ -72,7 +72,7 @@ public final class DisputeResultMessage extends DisputeMessage {
.build(); .build();
} }
public static DisputeResultMessage fromProto(protobuf.DisputeResultMessage proto, int messageVersion) { public static DisputeResultMessage fromProto(protobuf.DisputeResultMessage proto, String messageVersion) {
checkArgument(proto.hasDisputeResult(), "DisputeResult must be set"); checkArgument(proto.hasDisputeResult(), "DisputeResult must be set");
return new DisputeResultMessage(DisputeResult.fromProto(proto.getDisputeResult()), return new DisputeResultMessage(DisputeResult.fromProto(proto.getDisputeResult()),
NodeAddress.fromProto(proto.getSenderNodeAddress()), NodeAddress.fromProto(proto.getSenderNodeAddress()),

View file

@ -56,7 +56,7 @@ public final class OpenNewDisputeMessage extends DisputeMessage {
private OpenNewDisputeMessage(Dispute dispute, private OpenNewDisputeMessage(Dispute dispute,
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
String uid, String uid,
int messageVersion, String messageVersion,
SupportType supportType, SupportType supportType,
String updatedMultisigHex) { String updatedMultisigHex) {
super(messageVersion, uid, supportType); super(messageVersion, uid, supportType);
@ -79,7 +79,7 @@ public final class OpenNewDisputeMessage extends DisputeMessage {
public static OpenNewDisputeMessage fromProto(protobuf.OpenNewDisputeMessage proto, public static OpenNewDisputeMessage fromProto(protobuf.OpenNewDisputeMessage proto,
CoreProtoResolver coreProtoResolver, CoreProtoResolver coreProtoResolver,
int messageVersion) { String messageVersion) {
return new OpenNewDisputeMessage(Dispute.fromProto(proto.getDispute(), coreProtoResolver), return new OpenNewDisputeMessage(Dispute.fromProto(proto.getDispute(), coreProtoResolver),
NodeAddress.fromProto(proto.getSenderNodeAddress()), NodeAddress.fromProto(proto.getSenderNodeAddress()),
proto.getUid(), proto.getUid(),

View file

@ -53,7 +53,7 @@ public final class PeerOpenedDisputeMessage extends DisputeMessage {
private PeerOpenedDisputeMessage(Dispute dispute, private PeerOpenedDisputeMessage(Dispute dispute,
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
String uid, String uid,
int messageVersion, String messageVersion,
SupportType supportType) { SupportType supportType) {
super(messageVersion, uid, supportType); super(messageVersion, uid, supportType);
this.dispute = dispute; this.dispute = dispute;
@ -71,7 +71,7 @@ public final class PeerOpenedDisputeMessage extends DisputeMessage {
.build(); .build();
} }
public static PeerOpenedDisputeMessage fromProto(protobuf.PeerOpenedDisputeMessage proto, CoreProtoResolver coreProtoResolver, int messageVersion) { public static PeerOpenedDisputeMessage fromProto(protobuf.PeerOpenedDisputeMessage proto, CoreProtoResolver coreProtoResolver, String messageVersion) {
return new PeerOpenedDisputeMessage(Dispute.fromProto(proto.getDispute(), coreProtoResolver), return new PeerOpenedDisputeMessage(Dispute.fromProto(proto.getDispute(), coreProtoResolver),
NodeAddress.fromProto(proto.getSenderNodeAddress()), NodeAddress.fromProto(proto.getSenderNodeAddress()),
proto.getUid(), proto.getUid(),

View file

@ -183,7 +183,7 @@ public final class ChatMessage extends SupportMessage {
boolean arrived, boolean arrived,
boolean storedInMailbox, boolean storedInMailbox,
String uid, String uid,
int messageVersion, String messageVersion,
boolean acknowledged, boolean acknowledged,
@Nullable String sendMessageError, @Nullable String sendMessageError,
@Nullable String ackError, @Nullable String ackError,
@ -238,7 +238,7 @@ public final class ChatMessage extends SupportMessage {
// The protobuf definition ChatMessage cannot be changed as it would break backward compatibility. // The protobuf definition ChatMessage cannot be changed as it would break backward compatibility.
public static ChatMessage fromProto(protobuf.ChatMessage proto, public static ChatMessage fromProto(protobuf.ChatMessage proto,
int messageVersion) { String messageVersion) {
// If we get a msg from an old client type will be ordinal 0 which is the dispute entry and as we only added // If we get a msg from an old client type will be ordinal 0 which is the dispute entry and as we only added
// the trade case it is the desired behaviour. // the trade case it is the desired behaviour.
final ChatMessage chatMessage = new ChatMessage( final ChatMessage chatMessage = new ChatMessage(
@ -267,7 +267,7 @@ public final class ChatMessage extends SupportMessage {
// We don't check the message version here as it was checked in the carrier envelope already (in connection class) // We don't check the message version here as it was checked in the carrier envelope already (in connection class)
// Payloads don't have a message version and are also used for persistence // Payloads don't have a message version and are also used for persistence
// We set the value to -1 to indicate it is set but irrelevant // We set the value to -1 to indicate it is set but irrelevant
return fromProto(proto, -1); return fromProto(proto, "-1");
} }

View file

@ -35,7 +35,7 @@ public abstract class SupportMessage extends NetworkEnvelope implements MailboxM
// Added with v1.1.6. Old clients will not have set that field and we fall back to entry 0 which is ARBITRATION. // Added with v1.1.6. Old clients will not have set that field and we fall back to entry 0 which is ARBITRATION.
protected final SupportType supportType; protected final SupportType supportType;
public SupportMessage(int messageVersion, String uid, SupportType supportType) { public SupportMessage(String messageVersion, String uid, SupportType supportType) {
super(messageVersion); super(messageVersion);
this.uid = uid; this.uid = uid;
this.supportType = supportType; this.supportType = supportType;

View file

@ -72,7 +72,7 @@ public final class CounterCurrencyTransferStartedMessage extends TradeMailboxMes
@Nullable String counterCurrencyTxId, @Nullable String counterCurrencyTxId,
@Nullable String counterCurrencyExtraData, @Nullable String counterCurrencyExtraData,
String uid, String uid,
int messageVersion) { String messageVersion) {
super(messageVersion, tradeId, uid); super(messageVersion, tradeId, uid);
this.buyerPayoutAddress = buyerPayoutAddress; this.buyerPayoutAddress = buyerPayoutAddress;
this.senderNodeAddress = senderNodeAddress; this.senderNodeAddress = senderNodeAddress;
@ -97,7 +97,7 @@ public final class CounterCurrencyTransferStartedMessage extends TradeMailboxMes
} }
public static CounterCurrencyTransferStartedMessage fromProto(protobuf.CounterCurrencyTransferStartedMessage proto, public static CounterCurrencyTransferStartedMessage fromProto(protobuf.CounterCurrencyTransferStartedMessage proto,
int messageVersion) { String messageVersion) {
return new CounterCurrencyTransferStartedMessage(proto.getTradeId(), return new CounterCurrencyTransferStartedMessage(proto.getTradeId(),
proto.getBuyerPayoutAddress(), proto.getBuyerPayoutAddress(),
NodeAddress.fromProto(proto.getSenderNodeAddress()), NodeAddress.fromProto(proto.getSenderNodeAddress()),

View file

@ -52,7 +52,7 @@ public final class DelayedPayoutTxSignatureRequest extends TradeMessage implemen
// PROTO BUFFER // PROTO BUFFER
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private DelayedPayoutTxSignatureRequest(int messageVersion, private DelayedPayoutTxSignatureRequest(String messageVersion,
String uid, String uid,
String tradeId, String tradeId,
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
@ -78,7 +78,7 @@ public final class DelayedPayoutTxSignatureRequest extends TradeMessage implemen
} }
public static DelayedPayoutTxSignatureRequest fromProto(protobuf.DelayedPayoutTxSignatureRequest proto, public static DelayedPayoutTxSignatureRequest fromProto(protobuf.DelayedPayoutTxSignatureRequest proto,
int messageVersion) { String messageVersion) {
return new DelayedPayoutTxSignatureRequest(messageVersion, return new DelayedPayoutTxSignatureRequest(messageVersion,
proto.getUid(), proto.getUid(),
proto.getTradeId(), proto.getTradeId(),

View file

@ -52,7 +52,7 @@ public final class DelayedPayoutTxSignatureResponse extends TradeMessage impleme
// PROTO BUFFER // PROTO BUFFER
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private DelayedPayoutTxSignatureResponse(int messageVersion, private DelayedPayoutTxSignatureResponse(String messageVersion,
String uid, String uid,
String tradeId, String tradeId,
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
@ -79,7 +79,7 @@ public final class DelayedPayoutTxSignatureResponse extends TradeMessage impleme
} }
public static DelayedPayoutTxSignatureResponse fromProto(protobuf.DelayedPayoutTxSignatureResponse proto, public static DelayedPayoutTxSignatureResponse fromProto(protobuf.DelayedPayoutTxSignatureResponse proto,
int messageVersion) { String messageVersion) {
return new DelayedPayoutTxSignatureResponse(messageVersion, return new DelayedPayoutTxSignatureResponse(messageVersion,
proto.getUid(), proto.getUid(),
proto.getTradeId(), proto.getTradeId(),

View file

@ -41,7 +41,7 @@ public final class DepositRequest extends TradeMessage implements DirectMessage
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
PubKeyRing pubKeyRing, PubKeyRing pubKeyRing,
String uid, String uid,
int messageVersion, String messageVersion,
long currentDate, long currentDate,
String contractSignature, String contractSignature,
String depositTxHex, String depositTxHex,
@ -77,7 +77,7 @@ public final class DepositRequest extends TradeMessage implements DirectMessage
public static DepositRequest fromProto(protobuf.DepositRequest proto, public static DepositRequest fromProto(protobuf.DepositRequest proto,
CoreProtoResolver coreProtoResolver, CoreProtoResolver coreProtoResolver,
int messageVersion) { String messageVersion) {
return new DepositRequest(proto.getTradeId(), return new DepositRequest(proto.getTradeId(),
NodeAddress.fromProto(proto.getSenderNodeAddress()), NodeAddress.fromProto(proto.getSenderNodeAddress()),
PubKeyRing.fromProto(proto.getPubKeyRing()), PubKeyRing.fromProto(proto.getPubKeyRing()),

View file

@ -38,7 +38,7 @@ public final class DepositResponse extends TradeMessage implements DirectMessage
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
PubKeyRing pubKeyRing, PubKeyRing pubKeyRing,
String uid, String uid,
int messageVersion, String messageVersion,
long currentDate) { long currentDate) {
super(messageVersion, tradeId, uid); super(messageVersion, tradeId, uid);
this.senderNodeAddress = senderNodeAddress; this.senderNodeAddress = senderNodeAddress;
@ -65,7 +65,7 @@ public final class DepositResponse extends TradeMessage implements DirectMessage
public static DepositResponse fromProto(protobuf.DepositResponse proto, public static DepositResponse fromProto(protobuf.DepositResponse proto,
CoreProtoResolver coreProtoResolver, CoreProtoResolver coreProtoResolver,
int messageVersion) { String messageVersion) {
return new DepositResponse(proto.getTradeId(), return new DepositResponse(proto.getTradeId(),
NodeAddress.fromProto(proto.getSenderNodeAddress()), NodeAddress.fromProto(proto.getSenderNodeAddress()),
PubKeyRing.fromProto(proto.getPubKeyRing()), PubKeyRing.fromProto(proto.getPubKeyRing()),

View file

@ -53,7 +53,7 @@ public final class DepositTxAndDelayedPayoutTxMessage extends TradeMailboxMessag
// PROTO BUFFER // PROTO BUFFER
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private DepositTxAndDelayedPayoutTxMessage(int messageVersion, private DepositTxAndDelayedPayoutTxMessage(String messageVersion,
String uid, String uid,
String tradeId, String tradeId,
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
@ -78,7 +78,7 @@ public final class DepositTxAndDelayedPayoutTxMessage extends TradeMailboxMessag
} }
public static DepositTxAndDelayedPayoutTxMessage fromProto(protobuf.DepositTxAndDelayedPayoutTxMessage proto, public static DepositTxAndDelayedPayoutTxMessage fromProto(protobuf.DepositTxAndDelayedPayoutTxMessage proto,
int messageVersion) { String messageVersion) {
return new DepositTxAndDelayedPayoutTxMessage(messageVersion, return new DepositTxAndDelayedPayoutTxMessage(messageVersion,
proto.getUid(), proto.getUid(),
proto.getTradeId(), proto.getTradeId(),

View file

@ -67,7 +67,7 @@ public final class DepositTxMessage extends TradeMessage implements DirectMessag
return getNetworkEnvelopeBuilder().setDepositTxMessage(builder).build(); return getNetworkEnvelopeBuilder().setDepositTxMessage(builder).build();
} }
public static DepositTxMessage fromProto(protobuf.DepositTxMessage proto, int messageVersion) { public static DepositTxMessage fromProto(protobuf.DepositTxMessage proto, String messageVersion) {
return new DepositTxMessage(proto.getUid(), return new DepositTxMessage(proto.getUid(),
proto.getTradeId(), proto.getTradeId(),
NodeAddress.fromProto(proto.getSenderNodeAddress()), NodeAddress.fromProto(proto.getSenderNodeAddress()),

View file

@ -47,7 +47,7 @@ public final class InitMultisigRequest extends TradeMessage implements DirectMes
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
PubKeyRing pubKeyRing, PubKeyRing pubKeyRing,
String uid, String uid,
int messageVersion, String messageVersion,
long currentDate, long currentDate,
String preparedMultisigHex, String preparedMultisigHex,
String madeMultisigHex) { String madeMultisigHex) {
@ -82,7 +82,7 @@ public final class InitMultisigRequest extends TradeMessage implements DirectMes
public static InitMultisigRequest fromProto(protobuf.InitMultisigRequest proto, public static InitMultisigRequest fromProto(protobuf.InitMultisigRequest proto,
CoreProtoResolver coreProtoResolver, CoreProtoResolver coreProtoResolver,
int messageVersion) { String messageVersion) {
return new InitMultisigRequest(proto.getTradeId(), return new InitMultisigRequest(proto.getTradeId(),
NodeAddress.fromProto(proto.getSenderNodeAddress()), NodeAddress.fromProto(proto.getSenderNodeAddress()),
PubKeyRing.fromProto(proto.getPubKeyRing()), PubKeyRing.fromProto(proto.getPubKeyRing()),

View file

@ -78,7 +78,7 @@ public final class InitTradeRequest extends TradeMessage implements DirectMessag
String paymentAccountId, String paymentAccountId,
String paymentMethodId, String paymentMethodId,
String uid, String uid,
int messageVersion, String messageVersion,
@Nullable byte[] accountAgeWitnessSignatureOfOfferId, @Nullable byte[] accountAgeWitnessSignatureOfOfferId,
long currentDate, long currentDate,
NodeAddress makerNodeAddress, NodeAddress makerNodeAddress,
@ -145,7 +145,7 @@ public final class InitTradeRequest extends TradeMessage implements DirectMessag
public static InitTradeRequest fromProto(protobuf.InitTradeRequest proto, public static InitTradeRequest fromProto(protobuf.InitTradeRequest proto,
CoreProtoResolver coreProtoResolver, CoreProtoResolver coreProtoResolver,
int messageVersion) { String messageVersion) {
return new InitTradeRequest(proto.getTradeId(), return new InitTradeRequest(proto.getTradeId(),
NodeAddress.fromProto(proto.getSenderNodeAddress()), NodeAddress.fromProto(proto.getSenderNodeAddress()),
PubKeyRing.fromProto(proto.getPubKeyRing()), PubKeyRing.fromProto(proto.getPubKeyRing()),

View file

@ -90,7 +90,7 @@ public final class InputsForDepositTxRequest extends TradeMessage implements Dir
NodeAddress mediatorNodeAddress, NodeAddress mediatorNodeAddress,
NodeAddress refundAgentNodeAddress, NodeAddress refundAgentNodeAddress,
String uid, String uid,
int messageVersion, String messageVersion,
byte[] accountAgeWitnessSignatureOfOfferId, byte[] accountAgeWitnessSignatureOfOfferId,
long currentDate) { long currentDate) {
super(messageVersion, tradeId, uid); super(messageVersion, tradeId, uid);
@ -160,7 +160,7 @@ public final class InputsForDepositTxRequest extends TradeMessage implements Dir
public static InputsForDepositTxRequest fromProto(protobuf.InputsForDepositTxRequest proto, public static InputsForDepositTxRequest fromProto(protobuf.InputsForDepositTxRequest proto,
CoreProtoResolver coreProtoResolver, CoreProtoResolver coreProtoResolver,
int messageVersion) { String messageVersion) {
List<RawTransactionInput> rawTransactionInputs = proto.getRawTransactionInputsList().stream() List<RawTransactionInput> rawTransactionInputs = proto.getRawTransactionInputsList().stream()
.map(rawTransactionInput -> new RawTransactionInput(rawTransactionInput.getIndex(), .map(rawTransactionInput -> new RawTransactionInput(rawTransactionInput.getIndex(),
rawTransactionInput.getParentTransaction().toByteArray(), rawTransactionInput.getValue())) rawTransactionInput.getParentTransaction().toByteArray(), rawTransactionInput.getValue()))

View file

@ -106,7 +106,7 @@ public final class InputsForDepositTxResponse extends TradeMessage implements Di
List<RawTransactionInput> makerInputs, List<RawTransactionInput> makerInputs,
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
String uid, String uid,
int messageVersion, String messageVersion,
@Nullable byte[] accountAgeWitnessSignatureOfPreparedDepositTx, @Nullable byte[] accountAgeWitnessSignatureOfPreparedDepositTx,
long currentDate, long currentDate,
long lockTime) { long lockTime) {
@ -149,7 +149,7 @@ public final class InputsForDepositTxResponse extends TradeMessage implements Di
.build(); .build();
} }
public static InputsForDepositTxResponse fromProto(protobuf.InputsForDepositTxResponse proto, CoreProtoResolver coreProtoResolver, int messageVersion) { public static InputsForDepositTxResponse fromProto(protobuf.InputsForDepositTxResponse proto, CoreProtoResolver coreProtoResolver, String messageVersion) {
List<RawTransactionInput> makerInputs = proto.getMakerInputsList().stream() List<RawTransactionInput> makerInputs = proto.getMakerInputsList().stream()
.map(RawTransactionInput::fromProto) .map(RawTransactionInput::fromProto)
.collect(Collectors.toList()); .collect(Collectors.toList());

View file

@ -54,7 +54,7 @@ public final class MediatedPayoutTxPublishedMessage extends TradeMailboxMessage
byte[] payoutTx, byte[] payoutTx,
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
String uid, String uid,
int messageVersion) { String messageVersion) {
super(messageVersion, tradeId, uid); super(messageVersion, tradeId, uid);
this.payoutTx = payoutTx; this.payoutTx = payoutTx;
this.senderNodeAddress = senderNodeAddress; this.senderNodeAddress = senderNodeAddress;
@ -71,7 +71,7 @@ public final class MediatedPayoutTxPublishedMessage extends TradeMailboxMessage
.build(); .build();
} }
public static NetworkEnvelope fromProto(protobuf.MediatedPayoutTxPublishedMessage proto, int messageVersion) { public static NetworkEnvelope fromProto(protobuf.MediatedPayoutTxPublishedMessage proto, String messageVersion) {
return new MediatedPayoutTxPublishedMessage(proto.getTradeId(), return new MediatedPayoutTxPublishedMessage(proto.getTradeId(),
proto.getPayoutTx().toByteArray(), proto.getPayoutTx().toByteArray(),
NodeAddress.fromProto(proto.getSenderNodeAddress()), NodeAddress.fromProto(proto.getSenderNodeAddress()),

View file

@ -55,7 +55,7 @@ public class MediatedPayoutTxSignatureMessage extends TradeMailboxMessage {
String tradeId, String tradeId,
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
String uid, String uid,
int messageVersion) { String messageVersion) {
super(messageVersion, tradeId, uid); super(messageVersion, tradeId, uid);
this.txSignature = txSignature; this.txSignature = txSignature;
this.senderNodeAddress = senderNodeAddress; this.senderNodeAddress = senderNodeAddress;
@ -73,7 +73,7 @@ public class MediatedPayoutTxSignatureMessage extends TradeMailboxMessage {
} }
public static MediatedPayoutTxSignatureMessage fromProto(protobuf.MediatedPayoutTxSignatureMessage proto, public static MediatedPayoutTxSignatureMessage fromProto(protobuf.MediatedPayoutTxSignatureMessage proto,
int messageVersion) { String messageVersion) {
return new MediatedPayoutTxSignatureMessage(proto.getTxSignature().toByteArray(), return new MediatedPayoutTxSignatureMessage(proto.getTxSignature().toByteArray(),
proto.getTradeId(), proto.getTradeId(),
NodeAddress.fromProto(proto.getSenderNodeAddress()), NodeAddress.fromProto(proto.getSenderNodeAddress()),

View file

@ -40,7 +40,7 @@ public final class PaymentAccountPayloadRequest extends TradeMessage implements
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
PubKeyRing pubKeyRing, PubKeyRing pubKeyRing,
String uid, String uid,
int messageVersion, String messageVersion,
long currentDate, long currentDate,
PaymentAccountPayload paymentAccountPayload) { PaymentAccountPayload paymentAccountPayload) {
super(messageVersion, tradeId, uid); super(messageVersion, tradeId, uid);
@ -70,7 +70,7 @@ public final class PaymentAccountPayloadRequest extends TradeMessage implements
public static PaymentAccountPayloadRequest fromProto(protobuf.PaymentAccountPayloadRequest proto, public static PaymentAccountPayloadRequest fromProto(protobuf.PaymentAccountPayloadRequest proto,
CoreProtoResolver coreProtoResolver, CoreProtoResolver coreProtoResolver,
int messageVersion) { String messageVersion) {
return new PaymentAccountPayloadRequest(proto.getTradeId(), return new PaymentAccountPayloadRequest(proto.getTradeId(),
NodeAddress.fromProto(proto.getSenderNodeAddress()), NodeAddress.fromProto(proto.getSenderNodeAddress()),
PubKeyRing.fromProto(proto.getPubKeyRing()), PubKeyRing.fromProto(proto.getPubKeyRing()),

View file

@ -66,7 +66,7 @@ public final class PayoutTxPublishedMessage extends TradeMailboxMessage {
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
@Nullable SignedWitness signedWitness, @Nullable SignedWitness signedWitness,
String uid, String uid,
int messageVersion) { String messageVersion) {
super(messageVersion, tradeId, uid); super(messageVersion, tradeId, uid);
this.signedMultisigTxHex = signedMultisigTxHex; this.signedMultisigTxHex = signedMultisigTxHex;
this.senderNodeAddress = senderNodeAddress; this.senderNodeAddress = senderNodeAddress;
@ -84,7 +84,7 @@ public final class PayoutTxPublishedMessage extends TradeMailboxMessage {
return getNetworkEnvelopeBuilder().setPayoutTxPublishedMessage(builder).build(); return getNetworkEnvelopeBuilder().setPayoutTxPublishedMessage(builder).build();
} }
public static NetworkEnvelope fromProto(protobuf.PayoutTxPublishedMessage proto, int messageVersion) { public static NetworkEnvelope fromProto(protobuf.PayoutTxPublishedMessage proto, String messageVersion) {
// There is no method to check for a nullable non-primitive data type object but we know that all fields // There is no method to check for a nullable non-primitive data type object but we know that all fields
// are empty/null, so we check for the signature to see if we got a valid signedWitness. // are empty/null, so we check for the signature to see if we got a valid signedWitness.
protobuf.SignedWitness protoSignedWitness = proto.getSignedWitness(); protobuf.SignedWitness protoSignedWitness = proto.getSignedWitness();

View file

@ -43,7 +43,7 @@ public final class PeerPublishedDelayedPayoutTxMessage extends TradeMailboxMessa
// PROTO BUFFER // PROTO BUFFER
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private PeerPublishedDelayedPayoutTxMessage(int messageVersion, private PeerPublishedDelayedPayoutTxMessage(String messageVersion,
String uid, String uid,
String tradeId, String tradeId,
NodeAddress senderNodeAddress) { NodeAddress senderNodeAddress) {
@ -60,7 +60,7 @@ public final class PeerPublishedDelayedPayoutTxMessage extends TradeMailboxMessa
return getNetworkEnvelopeBuilder().setPeerPublishedDelayedPayoutTxMessage(builder).build(); return getNetworkEnvelopeBuilder().setPeerPublishedDelayedPayoutTxMessage(builder).build();
} }
public static PeerPublishedDelayedPayoutTxMessage fromProto(protobuf.PeerPublishedDelayedPayoutTxMessage proto, int messageVersion) { public static PeerPublishedDelayedPayoutTxMessage fromProto(protobuf.PeerPublishedDelayedPayoutTxMessage proto, String messageVersion) {
return new PeerPublishedDelayedPayoutTxMessage(messageVersion, return new PeerPublishedDelayedPayoutTxMessage(messageVersion,
proto.getUid(), proto.getUid(),
proto.getTradeId(), proto.getTradeId(),

View file

@ -39,7 +39,7 @@ public class RefreshTradeStateRequest extends TradeMailboxMessage {
// PROTO BUFFER // PROTO BUFFER
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private RefreshTradeStateRequest(int messageVersion, private RefreshTradeStateRequest(String messageVersion,
String uid, String uid,
String tradeId, String tradeId,
NodeAddress senderNodeAddress) { NodeAddress senderNodeAddress) {
@ -56,7 +56,7 @@ public class RefreshTradeStateRequest extends TradeMailboxMessage {
return getNetworkEnvelopeBuilder().setRefreshTradeStateRequest(builder).build(); return getNetworkEnvelopeBuilder().setRefreshTradeStateRequest(builder).build();
} }
public static RefreshTradeStateRequest fromProto(protobuf.RefreshTradeStateRequest proto, int messageVersion) { public static RefreshTradeStateRequest fromProto(protobuf.RefreshTradeStateRequest proto, String messageVersion) {
return new RefreshTradeStateRequest(messageVersion, return new RefreshTradeStateRequest(messageVersion,
proto.getUid(), proto.getUid(),
proto.getTradeId(), proto.getTradeId(),

View file

@ -42,7 +42,7 @@ public final class SignContractRequest extends TradeMessage implements DirectMes
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
PubKeyRing pubKeyRing, PubKeyRing pubKeyRing,
String uid, String uid,
int messageVersion, String messageVersion,
long currentDate, long currentDate,
String accountId, String accountId,
byte[] paymentAccountPayloadHash, byte[] paymentAccountPayloadHash,
@ -82,7 +82,7 @@ public final class SignContractRequest extends TradeMessage implements DirectMes
public static SignContractRequest fromProto(protobuf.SignContractRequest proto, public static SignContractRequest fromProto(protobuf.SignContractRequest proto,
CoreProtoResolver coreProtoResolver, CoreProtoResolver coreProtoResolver,
int messageVersion) { String messageVersion) {
return new SignContractRequest(proto.getTradeId(), return new SignContractRequest(proto.getTradeId(),
NodeAddress.fromProto(proto.getSenderNodeAddress()), NodeAddress.fromProto(proto.getSenderNodeAddress()),
PubKeyRing.fromProto(proto.getPubKeyRing()), PubKeyRing.fromProto(proto.getPubKeyRing()),

View file

@ -44,7 +44,7 @@ public final class SignContractResponse extends TradeMessage implements DirectMe
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
PubKeyRing pubKeyRing, PubKeyRing pubKeyRing,
String uid, String uid,
int messageVersion, String messageVersion,
long currentDate, long currentDate,
String contractSignature) { String contractSignature) {
super(messageVersion, tradeId, uid); super(messageVersion, tradeId, uid);
@ -76,7 +76,7 @@ public final class SignContractResponse extends TradeMessage implements DirectMe
public static SignContractResponse fromProto(protobuf.SignContractResponse proto, public static SignContractResponse fromProto(protobuf.SignContractResponse proto,
CoreProtoResolver coreProtoResolver, CoreProtoResolver coreProtoResolver,
int messageVersion) { String messageVersion) {
return new SignContractResponse(proto.getTradeId(), return new SignContractResponse(proto.getTradeId(),
NodeAddress.fromProto(proto.getSenderNodeAddress()), NodeAddress.fromProto(proto.getSenderNodeAddress()),
PubKeyRing.fromProto(proto.getPubKeyRing()), PubKeyRing.fromProto(proto.getPubKeyRing()),

View file

@ -29,7 +29,7 @@ import lombok.ToString;
public abstract class TradeMailboxMessage extends TradeMessage implements MailboxMessage { public abstract class TradeMailboxMessage extends TradeMessage implements MailboxMessage {
public static final long TTL = TimeUnit.DAYS.toMillis(15); public static final long TTL = TimeUnit.DAYS.toMillis(15);
protected TradeMailboxMessage(int messageVersion, String tradeId, String uid) { protected TradeMailboxMessage(String messageVersion, String tradeId, String uid) {
super(messageVersion, tradeId, uid); super(messageVersion, tradeId, uid);
} }

View file

@ -32,7 +32,7 @@ public abstract class TradeMessage extends NetworkEnvelope implements UidMessage
protected final String tradeId; protected final String tradeId;
protected final String uid; protected final String uid;
protected TradeMessage(int messageVersion, String tradeId, String uid) { protected TradeMessage(String messageVersion, String tradeId, String uid) {
super(messageVersion); super(messageVersion);
this.tradeId = tradeId; this.tradeId = tradeId;
this.uid = uid; this.uid = uid;

View file

@ -53,7 +53,7 @@ public class TraderSignedWitnessMessage extends TradeMailboxMessage {
// PROTO BUFFER // PROTO BUFFER
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private TraderSignedWitnessMessage(int messageVersion, private TraderSignedWitnessMessage(String messageVersion,
String uid, String uid,
String tradeId, String tradeId,
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
@ -73,7 +73,7 @@ public class TraderSignedWitnessMessage extends TradeMailboxMessage {
return getNetworkEnvelopeBuilder().setTraderSignedWitnessMessage(builder).build(); return getNetworkEnvelopeBuilder().setTraderSignedWitnessMessage(builder).build();
} }
public static TraderSignedWitnessMessage fromProto(protobuf.TraderSignedWitnessMessage proto, int messageVersion) { public static TraderSignedWitnessMessage fromProto(protobuf.TraderSignedWitnessMessage proto, String messageVersion) {
return new TraderSignedWitnessMessage(messageVersion, return new TraderSignedWitnessMessage(messageVersion,
proto.getUid(), proto.getUid(),
proto.getTradeId(), proto.getTradeId(),

View file

@ -45,7 +45,7 @@ public final class UpdateMultisigRequest extends TradeMessage implements DirectM
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
PubKeyRing pubKeyRing, PubKeyRing pubKeyRing,
String uid, String uid,
int messageVersion, String messageVersion,
long currentDate, long currentDate,
String updatedMultisigHex) { String updatedMultisigHex) {
super(messageVersion, tradeId, uid); super(messageVersion, tradeId, uid);
@ -77,7 +77,7 @@ public final class UpdateMultisigRequest extends TradeMessage implements DirectM
public static UpdateMultisigRequest fromProto(protobuf.UpdateMultisigRequest proto, public static UpdateMultisigRequest fromProto(protobuf.UpdateMultisigRequest proto,
CoreProtoResolver coreProtoResolver, CoreProtoResolver coreProtoResolver,
int messageVersion) { String messageVersion) {
return new UpdateMultisigRequest(proto.getTradeId(), return new UpdateMultisigRequest(proto.getTradeId(),
NodeAddress.fromProto(proto.getSenderNodeAddress()), NodeAddress.fromProto(proto.getSenderNodeAddress()),
PubKeyRing.fromProto(proto.getPubKeyRing()), PubKeyRing.fromProto(proto.getPubKeyRing()),

View file

@ -45,7 +45,7 @@ public final class UpdateMultisigResponse extends TradeMessage implements Direct
NodeAddress senderNodeAddress, NodeAddress senderNodeAddress,
PubKeyRing pubKeyRing, PubKeyRing pubKeyRing,
String uid, String uid,
int messageVersion, String messageVersion,
long currentDate, long currentDate,
String updatedMultisigHex) { String updatedMultisigHex) {
super(messageVersion, tradeId, uid); super(messageVersion, tradeId, uid);
@ -77,7 +77,7 @@ public final class UpdateMultisigResponse extends TradeMessage implements Direct
public static UpdateMultisigResponse fromProto(protobuf.UpdateMultisigResponse proto, public static UpdateMultisigResponse fromProto(protobuf.UpdateMultisigResponse proto,
CoreProtoResolver coreProtoResolver, CoreProtoResolver coreProtoResolver,
int messageVersion) { String messageVersion) {
return new UpdateMultisigResponse(proto.getTradeId(), return new UpdateMultisigResponse(proto.getTradeId(),
NodeAddress.fromProto(proto.getSenderNodeAddress()), NodeAddress.fromProto(proto.getSenderNodeAddress()),
PubKeyRing.fromProto(proto.getPubKeyRing()), PubKeyRing.fromProto(proto.getPubKeyRing()),

View file

@ -98,7 +98,7 @@ public final class AckMessage extends NetworkEnvelope implements MailboxMessage,
String sourceId, String sourceId,
boolean success, boolean success,
@Nullable String errorMessage, @Nullable String errorMessage,
int messageVersion) { String messageVersion) {
super(messageVersion); super(messageVersion);
this.uid = uid; this.uid = uid;
this.senderNodeAddress = senderNodeAddress; this.senderNodeAddress = senderNodeAddress;
@ -132,7 +132,7 @@ public final class AckMessage extends NetworkEnvelope implements MailboxMessage,
return builder; return builder;
} }
public static AckMessage fromProto(protobuf.AckMessage proto, int messageVersion) { public static AckMessage fromProto(protobuf.AckMessage proto, String messageVersion) {
AckMessageSourceType sourceType = ProtoUtil.enumFromProto(AckMessageSourceType.class, proto.getSourceType()); AckMessageSourceType sourceType = ProtoUtil.enumFromProto(AckMessageSourceType.class, proto.getSourceType());
return new AckMessage(proto.getUid(), return new AckMessage(proto.getUid(),
NodeAddress.fromProto(proto.getSenderNodeAddress()), NodeAddress.fromProto(proto.getSenderNodeAddress()),

View file

@ -57,7 +57,7 @@ public final class BundleOfEnvelopes extends BroadcastMessage implements Extende
// PROTO BUFFER // PROTO BUFFER
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private BundleOfEnvelopes(List<NetworkEnvelope> envelopes, int messageVersion) { private BundleOfEnvelopes(List<NetworkEnvelope> envelopes, String messageVersion) {
super(messageVersion); super(messageVersion);
this.envelopes = envelopes; this.envelopes = envelopes;
} }
@ -74,7 +74,7 @@ public final class BundleOfEnvelopes extends BroadcastMessage implements Extende
public static BundleOfEnvelopes fromProto(protobuf.BundleOfEnvelopes proto, public static BundleOfEnvelopes fromProto(protobuf.BundleOfEnvelopes proto,
NetworkProtoResolver resolver, NetworkProtoResolver resolver,
int messageVersion) { String messageVersion) {
List<NetworkEnvelope> envelopes = proto.getEnvelopesList() List<NetworkEnvelope> envelopes = proto.getEnvelopesList()
.stream() .stream()
.map(envelope -> { .map(envelope -> {

View file

@ -37,7 +37,7 @@ public final class CloseConnectionMessage extends NetworkEnvelope {
// PROTO BUFFER // PROTO BUFFER
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private CloseConnectionMessage(String reason, int messageVersion) { private CloseConnectionMessage(String reason, String messageVersion) {
super(messageVersion); super(messageVersion);
this.reason = reason; this.reason = reason;
} }
@ -51,7 +51,7 @@ public final class CloseConnectionMessage extends NetworkEnvelope {
.build(); .build();
} }
public static CloseConnectionMessage fromProto(protobuf.CloseConnectionMessage proto, int messageVersion) { public static CloseConnectionMessage fromProto(protobuf.CloseConnectionMessage proto, String messageVersion) {
return new CloseConnectionMessage(proto.getReason(), messageVersion); return new CloseConnectionMessage(proto.getReason(), messageVersion);
} }
} }

View file

@ -64,7 +64,7 @@ public final class PrefixedSealedAndSignedMessage extends NetworkEnvelope implem
SealedAndSigned sealedAndSigned, SealedAndSigned sealedAndSigned,
byte[] addressPrefixHash, byte[] addressPrefixHash,
String uid, String uid,
int messageVersion) { String messageVersion) {
super(messageVersion); super(messageVersion);
this.senderNodeAddress = checkNotNull(senderNodeAddress, "senderNodeAddress must not be null"); this.senderNodeAddress = checkNotNull(senderNodeAddress, "senderNodeAddress must not be null");
this.sealedAndSigned = sealedAndSigned; this.sealedAndSigned = sealedAndSigned;
@ -84,7 +84,7 @@ public final class PrefixedSealedAndSignedMessage extends NetworkEnvelope implem
} }
public static PrefixedSealedAndSignedMessage fromProto(protobuf.PrefixedSealedAndSignedMessage proto, public static PrefixedSealedAndSignedMessage fromProto(protobuf.PrefixedSealedAndSignedMessage proto,
int messageVersion) { String messageVersion) {
return new PrefixedSealedAndSignedMessage(NodeAddress.fromProto(proto.getNodeAddress()), return new PrefixedSealedAndSignedMessage(NodeAddress.fromProto(proto.getNodeAddress()),
SealedAndSigned.fromProto(proto.getSealedAndSigned()), SealedAndSigned.fromProto(proto.getSealedAndSigned()),
proto.getAddressPrefixHash().toByteArray(), proto.getAddressPrefixHash().toByteArray(),
@ -101,7 +101,7 @@ public final class PrefixedSealedAndSignedMessage extends NetworkEnvelope implem
SealedAndSigned.fromProto(proto.getSealedAndSigned()), SealedAndSigned.fromProto(proto.getSealedAndSigned()),
proto.getAddressPrefixHash().toByteArray(), proto.getAddressPrefixHash().toByteArray(),
proto.getUid(), proto.getUid(),
-1); "-1");
} }
@Override @Override

View file

@ -842,7 +842,7 @@ public class Connection implements HasCapabilities, Runnable, MessageListener {
return; return;
// Check P2P network ID // Check P2P network ID
if (proto.getMessageVersion() != Version.getP2PMessageVersion() if (!proto.getMessageVersion().equals(Version.getP2PMessageVersion())
&& reportInvalidRequest(RuleViolation.WRONG_NETWORK_ID)) { && reportInvalidRequest(RuleViolation.WRONG_NETWORK_ID)) {
log.warn("RuleViolation.WRONG_NETWORK_ID. version of message={}, app version={}, " + log.warn("RuleViolation.WRONG_NETWORK_ID. version of message={}, app version={}, " +
"proto.toTruncatedString={}", proto.getMessageVersion(), "proto.toTruncatedString={}", proto.getMessageVersion(),

View file

@ -44,7 +44,7 @@ public abstract class GetDataRequest extends NetworkEnvelope implements Extended
@Nullable @Nullable
protected final String version; protected final String version;
public GetDataRequest(int messageVersion, public GetDataRequest(String messageVersion,
int nonce, int nonce,
Set<byte[]> excludedKeys, Set<byte[]> excludedKeys,
@Nullable String version) { @Nullable String version) {

View file

@ -77,7 +77,7 @@ public final class GetDataResponse extends NetworkEnvelope implements SupportedC
int requestNonce, int requestNonce,
boolean isGetUpdatedDataResponse, boolean isGetUpdatedDataResponse,
@NotNull Capabilities supportedCapabilities, @NotNull Capabilities supportedCapabilities,
int messageVersion) { String messageVersion) {
super(messageVersion); super(messageVersion);
this.dataSet = dataSet; this.dataSet = dataSet;
@ -116,7 +116,7 @@ public final class GetDataResponse extends NetworkEnvelope implements SupportedC
public static GetDataResponse fromProto(protobuf.GetDataResponse proto, public static GetDataResponse fromProto(protobuf.GetDataResponse proto,
NetworkProtoResolver resolver, NetworkProtoResolver resolver,
int messageVersion) { String messageVersion) {
log.info("Received a GetDataResponse with {}", Utilities.readableFileSize(proto.getSerializedSize())); log.info("Received a GetDataResponse with {}", Utilities.readableFileSize(proto.getSerializedSize()));
Set<ProtectedStorageEntry> dataSet = proto.getDataSetList().stream() Set<ProtectedStorageEntry> dataSet = proto.getDataSetList().stream()
.map(entry -> (ProtectedStorageEntry) resolver.fromProto(entry)).collect(Collectors.toSet()); .map(entry -> (ProtectedStorageEntry) resolver.fromProto(entry)).collect(Collectors.toSet());

View file

@ -62,7 +62,7 @@ public final class GetUpdatedDataRequest extends GetDataRequest implements Sende
int nonce, int nonce,
Set<byte[]> excludedKeys, Set<byte[]> excludedKeys,
@Nullable String version, @Nullable String version,
int messageVersion) { String messageVersion) {
super(messageVersion, super(messageVersion,
nonce, nonce,
excludedKeys, excludedKeys,
@ -87,7 +87,7 @@ public final class GetUpdatedDataRequest extends GetDataRequest implements Sende
return proto; return proto;
} }
public static GetUpdatedDataRequest fromProto(protobuf.GetUpdatedDataRequest proto, int messageVersion) { public static GetUpdatedDataRequest fromProto(protobuf.GetUpdatedDataRequest proto, String messageVersion) {
Set<byte[]> excludedKeys = ProtoUtil.byteSetFromProtoByteStringList(proto.getExcludedKeysList()); Set<byte[]> excludedKeys = ProtoUtil.byteSetFromProtoByteStringList(proto.getExcludedKeysList());
String requestersVersion = ProtoUtil.stringOrNullFromProto(proto.getVersion()); String requestersVersion = ProtoUtil.stringOrNullFromProto(proto.getVersion());
log.info("Received a GetUpdatedDataRequest with {} kB and {} excluded key entries. Requesters version={}", log.info("Received a GetUpdatedDataRequest with {} kB and {} excluded key entries. Requesters version={}",

View file

@ -61,7 +61,7 @@ public final class PreliminaryGetDataRequest extends GetDataRequest implements A
Set<byte[]> excludedKeys, Set<byte[]> excludedKeys,
@Nullable String version, @Nullable String version,
Capabilities supportedCapabilities, Capabilities supportedCapabilities,
int messageVersion) { String messageVersion) {
super(messageVersion, nonce, excludedKeys, version); super(messageVersion, nonce, excludedKeys, version);
this.supportedCapabilities = supportedCapabilities; this.supportedCapabilities = supportedCapabilities;
@ -84,7 +84,7 @@ public final class PreliminaryGetDataRequest extends GetDataRequest implements A
return proto; return proto;
} }
public static PreliminaryGetDataRequest fromProto(protobuf.PreliminaryGetDataRequest proto, int messageVersion) { public static PreliminaryGetDataRequest fromProto(protobuf.PreliminaryGetDataRequest proto, String messageVersion) {
Set<byte[]> excludedKeys = ProtoUtil.byteSetFromProtoByteStringList(proto.getExcludedKeysList()); Set<byte[]> excludedKeys = ProtoUtil.byteSetFromProtoByteStringList(proto.getExcludedKeysList());
String requestersVersion = ProtoUtil.stringOrNullFromProto(proto.getVersion()); String requestersVersion = ProtoUtil.stringOrNullFromProto(proto.getVersion());
log.info("Received a PreliminaryGetDataRequest with {} kB and {} excluded key entries. Requesters version={}", log.info("Received a PreliminaryGetDataRequest with {} kB and {} excluded key entries. Requesters version={}",

View file

@ -38,7 +38,7 @@ public final class Ping extends NetworkEnvelope implements KeepAliveMessage {
// PROTO BUFFER // PROTO BUFFER
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private Ping(int nonce, int lastRoundTripTime, int messageVersion) { private Ping(int nonce, int lastRoundTripTime, String messageVersion) {
super(messageVersion); super(messageVersion);
this.nonce = nonce; this.nonce = nonce;
this.lastRoundTripTime = lastRoundTripTime; this.lastRoundTripTime = lastRoundTripTime;
@ -53,7 +53,7 @@ public final class Ping extends NetworkEnvelope implements KeepAliveMessage {
.build(); .build();
} }
public static Ping fromProto(protobuf.Ping proto, int messageVersion) { public static Ping fromProto(protobuf.Ping proto, String messageVersion) {
return new Ping(proto.getNonce(), proto.getLastRoundTripTime(), messageVersion); return new Ping(proto.getNonce(), proto.getLastRoundTripTime(), messageVersion);
} }
} }

View file

@ -37,7 +37,7 @@ public final class Pong extends NetworkEnvelope implements KeepAliveMessage {
// PROTO BUFFER // PROTO BUFFER
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private Pong(int requestNonce, int messageVersion) { private Pong(int requestNonce, String messageVersion) {
super(messageVersion); super(messageVersion);
this.requestNonce = requestNonce; this.requestNonce = requestNonce;
} }
@ -50,7 +50,7 @@ public final class Pong extends NetworkEnvelope implements KeepAliveMessage {
.build(); .build();
} }
public static Pong fromProto(protobuf.Pong proto, int messageVersion) { public static Pong fromProto(protobuf.Pong proto, String messageVersion) {
return new Pong(proto.getRequestNonce(), messageVersion); return new Pong(proto.getRequestNonce(), messageVersion);
} }
} }

View file

@ -66,7 +66,7 @@ public final class GetPeersRequest extends NetworkEnvelope implements PeerExchan
int nonce, int nonce,
Set<Peer> reportedPeers, Set<Peer> reportedPeers,
@Nullable Capabilities supportedCapabilities, @Nullable Capabilities supportedCapabilities,
int messageVersion) { String messageVersion) {
super(messageVersion); super(messageVersion);
checkNotNull(senderNodeAddress, "senderNodeAddress must not be null at GetPeersRequest"); checkNotNull(senderNodeAddress, "senderNodeAddress must not be null at GetPeersRequest");
this.senderNodeAddress = senderNodeAddress; this.senderNodeAddress = senderNodeAddress;
@ -93,7 +93,7 @@ public final class GetPeersRequest extends NetworkEnvelope implements PeerExchan
.build(); .build();
} }
public static GetPeersRequest fromProto(protobuf.GetPeersRequest proto, int messageVersion) { public static GetPeersRequest fromProto(protobuf.GetPeersRequest proto, String messageVersion) {
return new GetPeersRequest(NodeAddress.fromProto(proto.getSenderNodeAddress()), return new GetPeersRequest(NodeAddress.fromProto(proto.getSenderNodeAddress()),
proto.getNonce(), proto.getNonce(),
new HashSet<>(proto.getReportedPeersList().stream() new HashSet<>(proto.getReportedPeersList().stream()

View file

@ -59,7 +59,7 @@ public final class GetPeersResponse extends NetworkEnvelope implements PeerExcha
private GetPeersResponse(int requestNonce, private GetPeersResponse(int requestNonce,
Set<Peer> reportedPeers, Set<Peer> reportedPeers,
@Nullable Capabilities supportedCapabilities, @Nullable Capabilities supportedCapabilities,
int messageVersion) { String messageVersion) {
super(messageVersion); super(messageVersion);
this.requestNonce = requestNonce; this.requestNonce = requestNonce;
this.reportedPeers = reportedPeers; this.reportedPeers = reportedPeers;
@ -83,7 +83,7 @@ public final class GetPeersResponse extends NetworkEnvelope implements PeerExcha
.build(); .build();
} }
public static GetPeersResponse fromProto(protobuf.GetPeersResponse proto, int messageVersion) { public static GetPeersResponse fromProto(protobuf.GetPeersResponse proto, String messageVersion) {
HashSet<Peer> reportedPeers = proto.getReportedPeersList() HashSet<Peer> reportedPeers = proto.getReportedPeersList()
.stream() .stream()
.map(peer -> { .map(peer -> {

View file

@ -42,7 +42,7 @@ public final class AddDataMessage extends BroadcastMessage {
// PROTO BUFFER // PROTO BUFFER
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private AddDataMessage(ProtectedStorageEntry protectedStorageEntry, int messageVersion) { private AddDataMessage(ProtectedStorageEntry protectedStorageEntry, String messageVersion) {
super(messageVersion); super(messageVersion);
this.protectedStorageEntry = protectedStorageEntry; this.protectedStorageEntry = protectedStorageEntry;
} }
@ -62,7 +62,7 @@ public final class AddDataMessage extends BroadcastMessage {
.build(); .build();
} }
public static AddDataMessage fromProto(protobuf.AddDataMessage proto, NetworkProtoResolver resolver, int messageVersion) { public static AddDataMessage fromProto(protobuf.AddDataMessage proto, NetworkProtoResolver resolver, String messageVersion) {
return new AddDataMessage((ProtectedStorageEntry) resolver.fromProto(proto.getEntry()), messageVersion); return new AddDataMessage((ProtectedStorageEntry) resolver.fromProto(proto.getEntry()), messageVersion);
} }
} }

View file

@ -39,7 +39,7 @@ public final class AddPersistableNetworkPayloadMessage extends BroadcastMessage
// PROTO BUFFER // PROTO BUFFER
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private AddPersistableNetworkPayloadMessage(PersistableNetworkPayload persistableNetworkPayload, int messageVersion) { private AddPersistableNetworkPayloadMessage(PersistableNetworkPayload persistableNetworkPayload, String messageVersion) {
super(messageVersion); super(messageVersion);
this.persistableNetworkPayload = persistableNetworkPayload; this.persistableNetworkPayload = persistableNetworkPayload;
} }
@ -54,7 +54,7 @@ public final class AddPersistableNetworkPayloadMessage extends BroadcastMessage
public static AddPersistableNetworkPayloadMessage fromProto(protobuf.AddPersistableNetworkPayloadMessage proto, public static AddPersistableNetworkPayloadMessage fromProto(protobuf.AddPersistableNetworkPayloadMessage proto,
NetworkProtoResolver resolver, NetworkProtoResolver resolver,
int messageVersion) { String messageVersion) {
return new AddPersistableNetworkPayloadMessage((PersistableNetworkPayload) resolver.fromProto(proto.getPayload()), return new AddPersistableNetworkPayloadMessage((PersistableNetworkPayload) resolver.fromProto(proto.getPayload()),
messageVersion); messageVersion);
} }

View file

@ -23,7 +23,7 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public abstract class BroadcastMessage extends NetworkEnvelope { public abstract class BroadcastMessage extends NetworkEnvelope {
protected BroadcastMessage(int messageVersion) { protected BroadcastMessage(String messageVersion) {
super(messageVersion); super(messageVersion);
} }
} }

View file

@ -48,7 +48,7 @@ public final class RefreshOfferMessage extends BroadcastMessage {
byte[] signature, byte[] signature,
byte[] hashOfPayload, byte[] hashOfPayload,
int sequenceNumber, int sequenceNumber,
int messageVersion) { String messageVersion) {
super(messageVersion); super(messageVersion);
this.hashOfDataAndSeqNr = hashOfDataAndSeqNr; this.hashOfDataAndSeqNr = hashOfDataAndSeqNr;
this.signature = signature; this.signature = signature;
@ -67,7 +67,7 @@ public final class RefreshOfferMessage extends BroadcastMessage {
.build(); .build();
} }
public static RefreshOfferMessage fromProto(protobuf.RefreshOfferMessage proto, int messageVersion) { public static RefreshOfferMessage fromProto(protobuf.RefreshOfferMessage proto, String messageVersion) {
return new RefreshOfferMessage(proto.getHashOfDataAndSeqNr().toByteArray(), return new RefreshOfferMessage(proto.getHashOfDataAndSeqNr().toByteArray(),
proto.getSignature().toByteArray(), proto.getSignature().toByteArray(),
proto.getHashOfPayload().toByteArray(), proto.getHashOfPayload().toByteArray(),

View file

@ -40,7 +40,7 @@ public final class RemoveDataMessage extends BroadcastMessage {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private RemoveDataMessage(ProtectedStorageEntry protectedStorageEntry, private RemoveDataMessage(ProtectedStorageEntry protectedStorageEntry,
int messageVersion) { String messageVersion) {
super(messageVersion); super(messageVersion);
this.protectedStorageEntry = protectedStorageEntry; this.protectedStorageEntry = protectedStorageEntry;
} }
@ -53,7 +53,7 @@ public final class RemoveDataMessage extends BroadcastMessage {
.build(); .build();
} }
public static RemoveDataMessage fromProto(protobuf.RemoveDataMessage proto, NetworkProtoResolver resolver, int messageVersion) { public static RemoveDataMessage fromProto(protobuf.RemoveDataMessage proto, NetworkProtoResolver resolver, String messageVersion) {
return new RemoveDataMessage(ProtectedStorageEntry.fromProto(proto.getProtectedStorageEntry(), resolver), messageVersion); return new RemoveDataMessage(ProtectedStorageEntry.fromProto(proto.getProtectedStorageEntry(), resolver), messageVersion);
} }
} }

View file

@ -40,7 +40,7 @@ public final class RemoveMailboxDataMessage extends BroadcastMessage {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private RemoveMailboxDataMessage(ProtectedMailboxStorageEntry protectedMailboxStorageEntry, private RemoveMailboxDataMessage(ProtectedMailboxStorageEntry protectedMailboxStorageEntry,
int messageVersion) { String messageVersion) {
super(messageVersion); super(messageVersion);
this.protectedMailboxStorageEntry = protectedMailboxStorageEntry; this.protectedMailboxStorageEntry = protectedMailboxStorageEntry;
} }
@ -53,7 +53,7 @@ public final class RemoveMailboxDataMessage extends BroadcastMessage {
.build(); .build();
} }
public static RemoveMailboxDataMessage fromProto(protobuf.RemoveMailboxDataMessage proto, NetworkProtoResolver resolver, int messageVersion) { public static RemoveMailboxDataMessage fromProto(protobuf.RemoveMailboxDataMessage proto, NetworkProtoResolver resolver, String messageVersion) {
return new RemoveMailboxDataMessage(ProtectedMailboxStorageEntry.fromProto(proto.getProtectedStorageEntry(), resolver), messageVersion); return new RemoveMailboxDataMessage(ProtectedMailboxStorageEntry.fromProto(proto.getProtectedStorageEntry(), resolver), messageVersion);
} }
} }

View file

@ -117,13 +117,13 @@ public class EncryptionServiceTests {
public final int nonce; public final int nonce;
public MockMessage(int nonce) { public MockMessage(int nonce) {
super(0); super("0");
this.nonce = nonce; this.nonce = nonce;
} }
@Override @Override
public int getMessageVersion() { public String getMessageVersion() {
return 0; return "0";
} }
@Override @Override
@ -135,7 +135,7 @@ public class EncryptionServiceTests {
/*@Value /*@Value
final class TestMessage implements MailboxMessage { final class TestMessage implements MailboxMessage {
public String data = "test"; public String data = "test";
private final int messageVersion = Version.getP2PMessageVersion(); private final String messageVersion = Version.getP2PMessageVersion();
private final String uid; private final String uid;
private final String senderNodeAddress; private final String senderNodeAddress;

View file

@ -32,14 +32,14 @@ import lombok.Getter;
@Getter @Getter
public final class MockMailboxPayload extends NetworkEnvelope implements MailboxMessage, ExpirablePayload { public final class MockMailboxPayload extends NetworkEnvelope implements MailboxMessage, ExpirablePayload {
private final int messageVersion = Version.getP2PMessageVersion(); private final String messageVersion = Version.getP2PMessageVersion();
public final String msg; public final String msg;
public final NodeAddress senderNodeAddress; public final NodeAddress senderNodeAddress;
public long ttl = 0; public long ttl = 0;
private final String uid; private final String uid;
public MockMailboxPayload(String msg, NodeAddress senderNodeAddress) { public MockMailboxPayload(String msg, NodeAddress senderNodeAddress) {
super(0); super("0");
this.msg = msg; this.msg = msg;
this.senderNodeAddress = senderNodeAddress; this.senderNodeAddress = senderNodeAddress;
uid = UUID.randomUUID().toString(); uid = UUID.randomUUID().toString();

View file

@ -28,15 +28,15 @@ import org.apache.commons.lang3.NotImplementedException;
public final class MockPayload extends NetworkEnvelope implements ExpirablePayload { public final class MockPayload extends NetworkEnvelope implements ExpirablePayload {
public final String msg; public final String msg;
public long ttl; public long ttl;
private final int messageVersion = Version.getP2PMessageVersion(); private final String messageVersion = Version.getP2PMessageVersion();
public MockPayload(String msg) { public MockPayload(String msg) {
super(0); super("0");
this.msg = msg; this.msg = msg;
} }
@Override @Override
public int getMessageVersion() { public String getMessageVersion() {
return messageVersion; return messageVersion;
} }

View file

@ -53,7 +53,7 @@ public class P2PDataStorageOnMessageHandlerTest {
static class UnsupportedBroadcastMessage extends BroadcastMessage { static class UnsupportedBroadcastMessage extends BroadcastMessage {
UnsupportedBroadcastMessage() { UnsupportedBroadcastMessage() {
super(0); super("0");
} }
} }

View file

@ -23,6 +23,7 @@ import bisq.network.p2p.storage.payload.MailboxStoragePayload;
import bisq.network.p2p.storage.payload.ProtectedMailboxStorageEntry; import bisq.network.p2p.storage.payload.ProtectedMailboxStorageEntry;
import bisq.network.p2p.storage.payload.ProtectedStorageEntry; import bisq.network.p2p.storage.payload.ProtectedStorageEntry;
import bisq.common.app.Version;
import bisq.common.crypto.CryptoException; import bisq.common.crypto.CryptoException;
import bisq.common.crypto.KeyRing; import bisq.common.crypto.KeyRing;
import bisq.common.crypto.KeyStorage; import bisq.common.crypto.KeyStorage;
@ -62,6 +63,7 @@ public class AddDataMessageTest {
//noinspection ResultOfMethodCallIgnored //noinspection ResultOfMethodCallIgnored
dir1.mkdir(); dir1.mkdir();
keyRing1 = new KeyRing(new KeyStorage(dir1), null, true); keyRing1 = new KeyRing(new KeyStorage(dir1), null, true);
Version.setBaseCryptoNetworkId(1);
} }
@Test @Test

View file

@ -14,7 +14,7 @@ option java_multiple_files = true;
// Those are messages sent over wire // Those are messages sent over wire
message NetworkEnvelope { message NetworkEnvelope {
int32 message_version = 1; string message_version = 1;
oneof message { oneof message {
PreliminaryGetDataRequest preliminary_get_data_request = 2; PreliminaryGetDataRequest preliminary_get_data_request = 2;
GetDataResponse get_data_response = 3; GetDataResponse get_data_response = 3;