From 6920961dea1aa237f87dce6079f4dd42d01b59a0 Mon Sep 17 00:00:00 2001 From: Odysseas Gabrielides Date: Mon, 4 Sep 2023 12:21:53 +0300 Subject: [PATCH] feat: forbid temporary Asset Locks txes everywhere except RegTest --- src/evo/specialtxman.cpp | 3 +++ src/validation.cpp | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/evo/specialtxman.cpp b/src/evo/specialtxman.cpp index 62122888e2..69f576c349 100644 --- a/src/evo/specialtxman.cpp +++ b/src/evo/specialtxman.cpp @@ -51,6 +51,9 @@ static bool CheckSpecialTxInner(const CTransaction& tx, const CBlockIndex* pinde return CheckMNHFTx(tx, pindexPrev, state); case TRANSACTION_ASSET_LOCK: case TRANSACTION_ASSET_UNLOCK: + if (Params().NetworkIDString() != CBaseChainParams::REGTEST) { + return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-assetlock-regtest-only"); + } if (!llmq::utils::IsV20Active(pindexPrev)) { return state.Invalid(TxValidationResult::TX_CONSENSUS, "assetlocks-before-v20"); } diff --git a/src/validation.cpp b/src/validation.cpp index c5fe88154b..62ad4c4556 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -392,6 +392,11 @@ static bool ContextualCheckTransaction(const CTransaction& tx, TxValidationState tx.nType != TRANSACTION_ASSET_UNLOCK) { return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-type"); } + if (Params().NetworkIDString() != CBaseChainParams::REGTEST && + (tx.nType == TRANSACTION_ASSET_LOCK || tx.nType == TRANSACTION_ASSET_UNLOCK)) { + return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-assetlock-regtest-only"); + } + if (tx.IsCoinBase() && tx.nType != TRANSACTION_COINBASE) return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-cb-type"); } else if (tx.nType != TRANSACTION_NORMAL) {