From 69480b79e70d2aca345352f13383e61c3b63a95e Mon Sep 17 00:00:00 2001 From: Some Random Crypto Guy Date: Wed, 12 Jun 2024 15:10:53 +0100 Subject: [PATCH] activated unlock_time checks; added versioning to TESTNET; bumped version to 0.2.6 --- src/cryptonote_config.h | 2 +- src/cryptonote_core/blockchain.cpp | 19 ++----------------- src/cryptonote_core/cryptonote_core.cpp | 6 ++++++ src/version.cpp.in | 2 +- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index 60f7396..e62069b 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -216,7 +216,7 @@ #define HF_VERSION_ENABLE_ORACLE 2 #define HF_VERSION_SLIPPAGE_YIELD 2 -#define TESTNET_VERSION 5 +#define TESTNET_VERSION 6 #define STAGENET_VERSION 1 #define PER_KB_FEE_QUANTIZATION_DECIMALS 8 diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index a8c497a..63a95e4 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -1483,13 +1483,6 @@ bool Blockchain::validate_protocol_transaction(const block& b, uint64_t height, LOG_PRINT_L3("Blockchain::" << __func__); CHECK_AND_ASSERT_MES(b.tx_hashes.size() == txs.size(), false, "Invalid number of TXs / hashes supplied"); - // HERE BE DRAGONS!!! - // SRCG: There are security tests below that must be activated - this is a reminder to do so - if (m_nettype == TESTNET && TESTNET_VERSION >= 6) { - LOG_ERROR("Please activate the unlock_time security checks below and then remove this code : Blockchain::" << __func__); - assert(false); - } - if (!b.protocol_tx.vin.size()) { // Nothing is created by this TX - check no money is included CHECK_AND_ASSERT_MES(b.protocol_tx.vout.size() == 0, false, "void protocol transaction in the block has outputs"); @@ -1501,19 +1494,11 @@ bool Blockchain::validate_protocol_transaction(const block& b, uint64_t height, for (auto& o : b.protocol_tx.vout) { if (o.target.type() == typeid(txout_to_key)) { txout_to_key out = boost::get(o.target); - // HERE BE DRAGONS!!! - // SRCG: This test is a bad decision, and should be removed on the next iteration of TESTNET - if (m_nettype == MAINNET) - CHECK_AND_ASSERT_MES(out.unlock_time == CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW, false, "Invalid unlock time on protocol_tx output"); - // LAND AHOY!!! + CHECK_AND_ASSERT_MES(out.unlock_time == CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW, false, "Invalid unlock time on protocol_tx output"); outputs[out.key] = {out.asset_type, o.amount, out.unlock_time}; } else if (o.target.type() == typeid(txout_to_tagged_key)) { txout_to_tagged_key out = boost::get(o.target); - // HERE BE DRAGONS!!! - // SRCG: This test is a bad decision, and should be removed on the next iteration of TESTNET - if (m_nettype == MAINNET) - CHECK_AND_ASSERT_MES(out.unlock_time == CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW, false, "Invalid unlock time on protocol_tx output"); - // LAND AHOY!!! + CHECK_AND_ASSERT_MES(out.unlock_time == CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW, false, "Invalid unlock time on protocol_tx output"); outputs[out.key] = {out.asset_type, o.amount, out.unlock_time}; } else { MERROR("Block at height: " << height << " attempting to add protocol transaction with invalid type " << o.target.type().name()); diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 167cf7c..5fd9a6f 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -519,6 +519,12 @@ namespace cryptonote 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() << " ..."); diff --git a/src/version.cpp.in b/src/version.cpp.in index 2dff5f0..82c884f 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.2.5" +#define DEF_SALVIUM_VERSION "0.2.6" #define DEF_MONERO_VERSION_TAG "@VERSIONTAG@" #define DEF_MONERO_VERSION "0.18.3.3" #define DEF_MONERO_RELEASE_NAME "Zero"