Skip to content

Commit

Permalink
feat: forbid temporary Asset Locks txes everywhere except RegTest
Browse files Browse the repository at this point in the history
  • Loading branch information
ogabrielides committed Sep 4, 2023
1 parent 13db37a commit 6920961
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/evo/specialtxman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
5 changes: 5 additions & 0 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 6920961

Please sign in to comment.