diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index 9f1b922..de039c0 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -256,6 +256,7 @@ #define HF_VERSION_EMERGENCY_DIFFICULTY 12 #define HF_VERSION_MERGE_MINING 13 #define HF_VERSION_RESTRICTED_MERGE_MINING 14 +#define HF_VERSION_DISABLE_PEYA_AS_PARENT 15 #define HF_VERSION_REQUIRE_VIEW_TAGS 255 #define HF_VERSION_ENABLE_CONVERT 255 diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index a8fe152..5a1e1f3 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -5742,6 +5742,25 @@ leave: goto leave; } + if (!bl.aux_header && hf_version >= HF_VERSION_DISABLE_PEYA_AS_PARENT) + { + std::vector miner_tx_extra_fields; + if (!cryptonote::parse_tx_extra(bl.miner_tx.extra, miner_tx_extra_fields)) + { + MERROR_VER("Block with id: " << id << " has invalid miner tx extra while checking parent-side merge-mining tag ban"); + bvc.m_verifivation_failed = true; + goto leave; + } + + cryptonote::tx_extra_merge_mining_tag mm_tag; + if (cryptonote::find_tx_extra_field_by_type(miner_tx_extra_fields, mm_tag, 0)) + { + MERROR_VER("Block with id: " << id << " carries a parent-side merge mining tag in miner tx after HF_VERSION_DISABLE_PEYA_AS_PARENT"); + bvc.m_verifivation_failed = true; + goto leave; + } + } + // sanity check basic protocol tx properties; if(!prevalidate_protocol_transaction(bl, blockchain_height, hf_version)) { diff --git a/src/hardforks/hardforks.cpp b/src/hardforks/hardforks.cpp index 9031842..d5b427f 100644 --- a/src/hardforks/hardforks.cpp +++ b/src/hardforks/hardforks.cpp @@ -39,6 +39,9 @@ const hardfork_t mainnet_hard_forks[] = { {12, 3, 0, 1341378360 }, {13, 4, 0, 1341378480 }, {14, 5, 0, 1341378600 }, + // Temporary test height for disabling Peya-as-parent via parent-side merge-mining tags. + // Before real rollout this should be moved lower to the intended production activation height. + {15, 878, 0, 1341482760 }, }; const size_t num_mainnet_hard_forks = sizeof(mainnet_hard_forks) / sizeof(mainnet_hard_forks[0]); const uint64_t mainnet_hard_fork_version_1_till = 0; @@ -51,6 +54,9 @@ const hardfork_t testnet_hard_forks[] = { {12, 3, 0, 1341378360 }, {13, 4, 0, 1341378480 }, {14, 5, 0, 1341378600 }, + // Temporary test height for disabling Peya-as-parent via parent-side merge-mining tags. + // Before real rollout this should be moved lower to the intended production activation height. + {15, 878, 0, 1341482760 }, }; const size_t num_testnet_hard_forks = sizeof(testnet_hard_forks) / sizeof(testnet_hard_forks[0]); const uint64_t testnet_hard_fork_version_1_till = 0; @@ -63,5 +69,8 @@ const hardfork_t stagenet_hard_forks[] = { {12, 3, 0, 1341378360 }, {13, 4, 0, 1341378480 }, {14, 5, 0, 1341378600 }, + // Temporary test height for disabling Peya-as-parent via parent-side merge-mining tags. + // Before real rollout this should be moved lower to the intended production activation height. + {15, 878, 0, 1341482760 }, }; const size_t num_stagenet_hard_forks = sizeof(stagenet_hard_forks) / sizeof(stagenet_hard_forks[0]);