From c56cfc6754c7af70e74d18770f7de51f6fd5f37d Mon Sep 17 00:00:00 2001 From: Some Random Crypto Guy Date: Fri, 17 May 2024 13:09:57 +0100 Subject: [PATCH] added versioning to avoid inadvertent use of old nodes --- src/cryptonote_config.h | 9 ++++++--- src/cryptonote_core/cryptonote_core.cpp | 10 ++++++++-- src/version.cpp.in | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index 0eb8084..e4ba702 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -215,6 +215,9 @@ #define HF_VERSION_ENABLE_ORACLE 2 #define HF_VERSION_SLIPPAGE_YIELD 2 +#define TESTNET_VERSION 4 +#define STAGENET_VERSION 1 + #define PER_KB_FEE_QUANTIZATION_DECIMALS 8 #define CRYPTONOTE_SCALING_2021_FEE_ROUNDING_PLACES 2 @@ -256,7 +259,7 @@ namespace config uint16_t const RPC_DEFAULT_PORT = 19081; uint16_t const ZMQ_RPC_DEFAULT_PORT = 19082; boost::uuids::uuid const NETWORK_ID = { { - 0x12 ,0x30, 0xF1, 0x71 , 0x61, 0x04 , 0x41, 0x61, 0x17, 0x31, 0x00, 0x82, 0x53, 0x41, 0x4C, 0x10 + 0x12 ,0x30, 0xF1, 0x71 , 0x61, 0x04 , 0x41, 0x61, 0x17, 0x31, 0x82, 0x53, 0x41, 0x4C, 0xFF, 0x10 } }; std::string const GENESIS_TX = "0201ff000180c0d0c7bbbff60302c33815291bac1b6d5c685129c1de6383e550688d005a3ce2b66a96b7050579060353414c3c00000000000000210149117096744b390170a118fc14d8f13edb40a7d2764fde3043d9fbae7d2efdef010000"; @@ -331,7 +334,7 @@ namespace config uint16_t const RPC_DEFAULT_PORT = 29081; uint16_t const ZMQ_RPC_DEFAULT_PORT = 29082; boost::uuids::uuid const NETWORK_ID = { { - 0x12 ,0x30, 0xF1, 0x71 , 0x61, 0x04 , 0x41, 0x61, 0x17, 0x31, 0x00, 0x82, 0x53, 0x41, 0x4C, 0x11 + 0x12 ,0x30, 0xF1, 0x71 , 0x61, 0x04 , 0x41, 0x61, 0x17, 0x31, 0x82, 0x53, 0x41, 0x4C, 0x00, 0x01 } }; std::string const GENESIS_TX = "0201ff000180c0d0c7bbbff6030204f30dcd0ffa78009527d89113e104e49486b14abd230a03becca67c15b2bbba0353414c3c000000000000002101b26ac50aaf94cf9df780e2c57bd61983123d96325fffa8e6603665a255d3810c010000"; uint32_t const GENESIS_NONCE = 10001; @@ -357,7 +360,7 @@ namespace config uint16_t const RPC_DEFAULT_PORT = 39081; uint16_t const ZMQ_RPC_DEFAULT_PORT = 39082; boost::uuids::uuid const NETWORK_ID = { { - 0x12 ,0x30, 0xF1, 0x71 , 0x61, 0x04 , 0x41, 0x61, 0x17, 0x31, 0x00, 0x82, 0x53, 0x41, 0x4C, 0x12 + 0x12 ,0x30, 0xF1, 0x71 , 0x61, 0x04 , 0x41, 0x61, 0x17, 0x31, 0x82, 0x53, 0x41, 0x4C, 0x80, 0x01 } }; std::string const GENESIS_TX = "013c01ff0001ffffffffffff0302df5d56da0c7d643ddd1ce61901c7bdc5fb1738bfe39fbe69c28a3a7032729c0f2101168d0c4ca86fb55a4cf6a36d31431be1c53a3bd7411bb24e8832410289fa6f3b"; uint32_t const GENESIS_NONCE = 10002; diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 6aa116b..393b640 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -518,10 +518,16 @@ namespace cryptonote LOG_ERROR("Failed to initialize a database"); return false; } - + + if (m_nettype == STAGENET) { + folder /= std::to_string(STAGENET_VERSION); + } else if (m_nettype == TESTNET) { + folder /= std::to_string(TESTNET_VERSION); + } + folder /= db->get_db_name(); MGINFO("Loading blockchain from folder " << folder.string() << " ..."); - + const std::string filename = folder.string(); // default to fast:async:1 if overridden blockchain_db_sync_mode sync_mode = db_defaultsync; diff --git a/src/version.cpp.in b/src/version.cpp.in index 03ceaaf..8c53cc6 100644 --- a/src/version.cpp.in +++ b/src/version.cpp.in @@ -1,5 +1,5 @@ #define DEF_SALVIUM_VERSION_TAG "7f6b8da" -#define DEF_SALVIUM_VERSION "0.0.3" +#define DEF_SALVIUM_VERSION "0.0.4" #define DEF_MONERO_VERSION_TAG "@VERSIONTAG@" #define DEF_MONERO_VERSION "0.18.2.2" #define DEF_MONERO_RELEASE_NAME "Zero"