activated unlock_time checks; added versioning to TESTNET; bumped version to 0.2.6

This commit is contained in:
Some Random Crypto Guy
2024-06-12 15:10:53 +01:00
parent 203cc7ee45
commit 69480b79e7
4 changed files with 10 additions and 19 deletions

View File

@@ -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

View File

@@ -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<txout_to_key>(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<txout_to_tagged_key>(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());

View File

@@ -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() << " ...");

View File

@@ -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"