added user tx verification
This commit is contained in:
@@ -222,7 +222,7 @@
|
||||
|
||||
#define HF_VERSION_ENFORCE_FULL_PROOFS 4
|
||||
|
||||
#define HF_VERSION_SHUTDOWN_USER_TXS 6
|
||||
#define HF_VERSION_SHUTDOWN_USER_TXS 5
|
||||
|
||||
#define HF_VERSION_REQUIRE_VIEW_TAGS 255
|
||||
#define HF_VERSION_ENABLE_CONVERT 255
|
||||
|
||||
@@ -1499,6 +1499,7 @@ bool Blockchain::validate_miner_transaction(const block& b, size_t cumulative_bl
|
||||
case HF_VERSION_ENABLE_N_OUTS:
|
||||
case HF_VERSION_FULL_PROOFS:
|
||||
case HF_VERSION_ENFORCE_FULL_PROOFS:
|
||||
case HF_VERSION_SHUTDOWN_USER_TXS:
|
||||
if (b.miner_tx.amount_burnt > 0) {
|
||||
CHECK_AND_ASSERT_MES(money_in_use + b.miner_tx.amount_burnt > money_in_use, false, "miner transaction is overflowed by amount_burnt");
|
||||
money_in_use += b.miner_tx.amount_burnt;
|
||||
@@ -3656,15 +3657,6 @@ bool Blockchain::check_tx_type_and_version(const transaction& tx, tx_verificatio
|
||||
|
||||
const uint8_t hf_version = m_hardfork->get_current_version();
|
||||
|
||||
// Reject ALL TXs except miner + protocol for v5
|
||||
if (hf_version == HF_VERSION_SHUTDOWN_USER_TXS) {
|
||||
if (tx.type != cryptonote::transaction_type::MINER && tx.type != cryptonote::transaction_type::PROTOCOL) {
|
||||
MERROR_VER("User TXs are not permitted for v" + std::to_string(HF_VERSION_SHUTDOWN_USER_TXS));
|
||||
tvc.m_version_mismatch = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Prior to v2, only allow TX v2
|
||||
if (hf_version < HF_VERSION_ENABLE_N_OUTS) {
|
||||
|
||||
|
||||
@@ -591,6 +591,7 @@ namespace cryptonote
|
||||
case HF_VERSION_ENABLE_N_OUTS:
|
||||
case HF_VERSION_FULL_PROOFS:
|
||||
case HF_VERSION_ENFORCE_FULL_PROOFS:
|
||||
case HF_VERSION_SHUTDOWN_USER_TXS:
|
||||
// SRCG: subtract 20% that will be rewarded to staking users
|
||||
CHECK_AND_ASSERT_MES(tx.amount_burnt == 0, false, "while creating outs: amount_burnt is nonzero");
|
||||
tx.amount_burnt = amount / 5;
|
||||
|
||||
@@ -167,6 +167,15 @@ namespace cryptonote
|
||||
return false;
|
||||
}
|
||||
|
||||
// Reject ALL TXs except miner + protocol for v5
|
||||
if (version == HF_VERSION_SHUTDOWN_USER_TXS) {
|
||||
if (tx.type != cryptonote::transaction_type::MINER && tx.type != cryptonote::transaction_type::PROTOCOL) {
|
||||
LOG_PRINT_L1("User TXs are not permitted for v" + std::to_string(HF_VERSION_SHUTDOWN_USER_TXS));
|
||||
tvc.m_verifivation_failed = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_inputs_types_supported(tx))
|
||||
{
|
||||
tvc.m_verifivation_failed = true;
|
||||
|
||||
@@ -61,7 +61,7 @@ const hardfork_t testnet_hard_forks[] = {
|
||||
{ 3, 500, 0, 1729518000 },
|
||||
|
||||
// version 4 starts from block 600
|
||||
{ 4, 600, 0, 173626500 },
|
||||
{ 4, 600, 0, 1736265000 },
|
||||
|
||||
// version 5 starts from block 700
|
||||
{ 5, 700, 0, 1736265945 },
|
||||
|
||||
Reference in New Issue
Block a user