mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-23 15:10:41 -04:00
Change network version to avoid connecting to bisq nodes (#275)
Co-authored-by: l0nelyc0w <coinrunner@danwin1210.me>
This commit is contained in:
parent
435051f204
commit
00765d7b32
70 changed files with 142 additions and 135 deletions
|
@ -85,7 +85,7 @@ public class Version {
|
|||
// If objects are used for both network and database the network version is applied.
|
||||
// VERSION = 0.5.0 -> P2P_NETWORK_VERSION = 1
|
||||
// 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.
|
||||
// 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.5.0 -> 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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
// 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() {
|
||||
|
|
|
@ -28,14 +28,14 @@ import static com.google.common.base.Preconditions.checkArgument;
|
|||
@EqualsAndHashCode
|
||||
public abstract class NetworkEnvelope implements Envelope {
|
||||
|
||||
protected final int messageVersion;
|
||||
protected final String messageVersion;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// PROTO BUFFER
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
protected NetworkEnvelope(int messageVersion) {
|
||||
protected NetworkEnvelope(String messageVersion) {
|
||||
this.messageVersion = messageVersion;
|
||||
}
|
||||
|
||||
|
@ -57,10 +57,10 @@ public abstract class NetworkEnvelope implements Envelope {
|
|||
// API
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public int getMessageVersion() {
|
||||
public String getMessageVersion() {
|
||||
// -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
|
||||
checkArgument(messageVersion != 0, "messageVersion is not set (0).");
|
||||
checkArgument(!messageVersion.equals("0"), "messageVersion is not set (0).");
|
||||
return messageVersion;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue