mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-28 17:34:11 -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
|
@ -28,34 +28,46 @@ public class Version {
|
|||
|
||||
// The version nr. for the objects sent over the network. A change will break the serialization of old objects.
|
||||
// If objects are used for both network and database the network version is applied.
|
||||
public static final long NETWORK_PROTOCOL_VERSION = 2;
|
||||
public static final long P2P_NETWORK_VERSION = 1;
|
||||
|
||||
// The version nr. of the serialized data stored to disc. A change will break the serialization of old objects.
|
||||
public static final long LOCAL_DB_VERSION = 2;
|
||||
public static final long LOCAL_DB_VERSION = 1;
|
||||
|
||||
// The version nr. of the current protocol. The offer holds that version.
|
||||
// A taker will check the version of the offers to see if his version is compatible.
|
||||
// TODO not used yet
|
||||
public static final long PROTOCOL_VERSION = 1;
|
||||
public static final long TRADE_PROTOCOL_VERSION = 1;
|
||||
|
||||
// The version for the bitcoin network (Mainnet = 0, TestNet = 1, Regtest = 2)
|
||||
private static int NETWORK_ID;
|
||||
|
||||
public static int getNetworkId() {
|
||||
return NETWORK_ID;
|
||||
public static int getP2PMessageVersion() {
|
||||
// A changed NETWORK_PROTOCOL_VERSION for the serialized objects does not trigger reliable a disconnect.
|
||||
// TODO investigate why, but java serialisation should be replaced anyway, so using one existing field
|
||||
// for the version is fine.
|
||||
// BTC_NETWORK_ID is 0, 1 or 2, we use for changes at NETWORK_PROTOCOL_VERSION a multiplication with 10
|
||||
// to avoid conflicts:
|
||||
// E.g. btc BTC_NETWORK_ID=1, NETWORK_PROTOCOL_VERSION=1 -> getNetworkId()=2;
|
||||
// BTC_NETWORK_ID=0, NETWORK_PROTOCOL_VERSION=2 -> getNetworkId()=2; -> wrong
|
||||
return BTC_NETWORK_ID + 10 * (int) P2P_NETWORK_VERSION;
|
||||
}
|
||||
|
||||
public static void setNetworkId(int networkId) {
|
||||
NETWORK_ID = networkId;
|
||||
// The version for the bitcoin network (Mainnet = 0, TestNet = 1, Regtest = 2)
|
||||
private static int BTC_NETWORK_ID;
|
||||
|
||||
public static void setBtcNetworkId(int btcNetworkId) {
|
||||
BTC_NETWORK_ID = btcNetworkId;
|
||||
}
|
||||
|
||||
public static int getBtcNetworkId() {
|
||||
return BTC_NETWORK_ID;
|
||||
}
|
||||
|
||||
public static void printVersion() {
|
||||
log.info("Version{" +
|
||||
"VERSION=" + VERSION +
|
||||
", NETWORK_PROTOCOL_VERSION=" + NETWORK_PROTOCOL_VERSION +
|
||||
", P2P_NETWORK_VERSION=" + P2P_NETWORK_VERSION +
|
||||
", LOCAL_DB_VERSION=" + LOCAL_DB_VERSION +
|
||||
", PROTOCOL_VERSION=" + PROTOCOL_VERSION +
|
||||
", NETWORK_ID=" + NETWORK_ID +
|
||||
", TRADE_PROTOCOL_VERSION=" + TRADE_PROTOCOL_VERSION +
|
||||
", BTC_NETWORK_ID=" + BTC_NETWORK_ID +
|
||||
", getP2PNetworkId()=" + getP2PMessageVersion() +
|
||||
'}');
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue