From 54c753b7c070a242425997f77eb393bbf8e97d23 Mon Sep 17 00:00:00 2001 From: dexX7 Date: Tue, 14 Jun 2022 13:02:17 +0200 Subject: [PATCH] Bundle activations of NFT adjustments and send-to-many --- src/omnicore/nftdb.cpp | 5 ++--- src/omnicore/rules.cpp | 35 +++++++++++------------------------ src/omnicore/rules.h | 4 ++-- src/omnicore/tx.cpp | 6 +++--- 4 files changed, 18 insertions(+), 32 deletions(-) diff --git a/src/omnicore/nftdb.cpp b/src/omnicore/nftdb.cpp index 5886484383a040..faaa21d4c930fc 100644 --- a/src/omnicore/nftdb.cpp +++ b/src/omnicore/nftdb.cpp @@ -423,14 +423,13 @@ void CMPNonFungibleTokensDB::SanityCheck() for (std::map::iterator it = totals.begin(); it != totals.end(); ++it) { if (mastercore::getTotalTokens(it->first) != it->second) { - std::string abortMsg = strprintf("Failed sanity check on property %d (%d != %d)\n", it->first, mastercore::getTotalTokens(it->first), it->second); - AbortNode(abortMsg); + PrintToLog("Failed sanity check on property %d (%d != %d)\n", it->first, mastercore::getTotalTokens(it->first), it->second); } else { result = result + strprintf("%d:%d=%d,", it->first, mastercore::getTotalTokens(it->first), it->second); } } - if (msc_debug_nftdb) PrintToLog("UTDB sanity check OK (%s)\n", result); + if (msc_debug_nftdb) PrintToLog("UTDB sanity check (%s)\n", result); } void CMPNonFungibleTokensDB::printStats() diff --git a/src/omnicore/rules.cpp b/src/omnicore/rules.cpp index 0f32e111245ad4..56f95dbd4fa69b 100644 --- a/src/omnicore/rules.cpp +++ b/src/omnicore/rules.cpp @@ -80,7 +80,7 @@ std::vector CConsensusParams::GetRestrictions() const { MSC_TYPE_SEND_NONFUNGIBLE, MP_TX_PKT_V0, false, MSC_NONFUNGIBLE_BLOCK }, { MSC_TYPE_NONFUNGIBLE_DATA, MP_TX_PKT_V0, false, MSC_NONFUNGIBLE_BLOCK }, - { MSC_TYPE_SEND_TO_MANY, MP_TX_PKT_V0, false, MSC_SEND_TO_MANY_BLOCK }, + { MSC_TYPE_SEND_TO_MANY, MP_TX_PKT_V0, false, MSC_SEND_TO_MANY_NFT_FIX_BLOCK }, }; const size_t nSize = sizeof(vTxRestrictions) / sizeof(vTxRestrictions[0]); @@ -257,7 +257,7 @@ CMainConsensusParams::CMainConsensusParams() MSC_ANYDATA_BLOCK = 0; MSC_NONFUNGIBLE_BLOCK = 999999; MSC_DELEGATED_ISSUANCE_BLOCK = 999999; - MSC_SEND_TO_MANY_BLOCK = 999999; + MSC_SEND_TO_MANY_NFT_FIX_BLOCK = 999999; // Other feature activations: GRANTEFFECTS_FEATURE_BLOCK = 394500; DEXMATH_FEATURE_BLOCK = 395000; @@ -266,7 +266,6 @@ CMainConsensusParams::CMainConsensusParams() FEES_FEATURE_BLOCK = 999999; FREEZENOTICE_FEATURE_BLOCK = 999999; FREEDEX_FEATURE_BLOCK = 999999; - NONFUNGIBLETOKEN_ISSUER_DATA = 999999; } /** @@ -304,7 +303,7 @@ CTestNetConsensusParams::CTestNetConsensusParams() MSC_ANYDATA_BLOCK = 0; MSC_NONFUNGIBLE_BLOCK = 0; MSC_DELEGATED_ISSUANCE_BLOCK = 0; - MSC_SEND_TO_MANY_BLOCK = 0; + MSC_SEND_TO_MANY_NFT_FIX_BLOCK = 0; // Other feature activations: GRANTEFFECTS_FEATURE_BLOCK = 0; DEXMATH_FEATURE_BLOCK = 0; @@ -313,7 +312,6 @@ CTestNetConsensusParams::CTestNetConsensusParams() FEES_FEATURE_BLOCK = 0; FREEZENOTICE_FEATURE_BLOCK = 0; FREEDEX_FEATURE_BLOCK = 0; - NONFUNGIBLETOKEN_ISSUER_DATA = 0; } /** @@ -351,7 +349,7 @@ CRegTestConsensusParams::CRegTestConsensusParams() MSC_ANYDATA_BLOCK = 0; MSC_NONFUNGIBLE_BLOCK = 0; MSC_DELEGATED_ISSUANCE_BLOCK = 0; - MSC_SEND_TO_MANY_BLOCK = 0; + MSC_SEND_TO_MANY_NFT_FIX_BLOCK = 0; // Other feature activations: GRANTEFFECTS_FEATURE_BLOCK = 999999; DEXMATH_FEATURE_BLOCK = 999999; @@ -360,7 +358,6 @@ CRegTestConsensusParams::CRegTestConsensusParams() FEES_FEATURE_BLOCK = 999999; FREEZENOTICE_FEATURE_BLOCK = 999999; FREEDEX_FEATURE_BLOCK = 999999; - NONFUNGIBLETOKEN_ISSUER_DATA = 999999; } //! Consensus parameters for mainnet @@ -532,14 +529,11 @@ bool ActivateFeature(uint16_t featureId, int activationBlock, uint32_t minClient case FEATURE_NONFUNGIBLE: MutableConsensusParams().MSC_NONFUNGIBLE_BLOCK = activationBlock; break; - case FEATURE_NONFUNGIBLE_ISSUER: - MutableConsensusParams().NONFUNGIBLETOKEN_ISSUER_DATA = activationBlock; - break; case FEATURE_DELEGATEDISSUANCE: MutableConsensusParams().MSC_DELEGATED_ISSUANCE_BLOCK = activationBlock; break; - case FEATURE_SEND_TO_MANY: - MutableConsensusParams().MSC_SEND_TO_MANY_BLOCK = activationBlock; + case FEATURE_SEND_TO_MANY_NFT_FIX: + MutableConsensusParams().MSC_SEND_TO_MANY_NFT_FIX_BLOCK = activationBlock; break; default: supported = false; @@ -618,14 +612,11 @@ bool DeactivateFeature(uint16_t featureId, int transactionBlock) case FEATURE_NONFUNGIBLE: MutableConsensusParams().MSC_NONFUNGIBLE_BLOCK = 999999; break; - case FEATURE_NONFUNGIBLE_ISSUER: - MutableConsensusParams().NONFUNGIBLETOKEN_ISSUER_DATA = 999999; - break; case FEATURE_DELEGATEDISSUANCE: MutableConsensusParams().MSC_DELEGATED_ISSUANCE_BLOCK = 999999; break; - case FEATURE_SEND_TO_MANY: - MutableConsensusParams().MSC_SEND_TO_MANY_BLOCK = 999999; + case FEATURE_SEND_TO_MANY_NFT_FIX: + MutableConsensusParams().MSC_SEND_TO_MANY_NFT_FIX_BLOCK = 999999; break; default: return false; @@ -660,9 +651,8 @@ std::string GetFeatureName(uint16_t featureId) case FEATURE_FREEZENOTICE: return "Activate the waiting period for enabling freezing"; case FEATURE_FREEDEX: return "Activate trading of any token on the distributed exchange"; case FEATURE_NONFUNGIBLE: return "Uniquely identifiable tokens"; - case FEATURE_NONFUNGIBLE_ISSUER: return "NFT issuer data update by issuers only"; case FEATURE_DELEGATEDISSUANCE: return "Activate delegated issuance of tokens"; - case FEATURE_SEND_TO_MANY: return "Activate send-to-many transactions"; + case FEATURE_SEND_TO_MANY_NFT_FIX: return "Activate send-to-many transactions"; default: return "Unknown feature"; } @@ -716,14 +706,11 @@ bool IsFeatureActivated(uint16_t featureId, int transactionBlock) case FEATURE_NONFUNGIBLE: activationBlock = params.MSC_NONFUNGIBLE_BLOCK; break; - case FEATURE_NONFUNGIBLE_ISSUER: - activationBlock = params.NONFUNGIBLETOKEN_ISSUER_DATA; - break; case FEATURE_DELEGATEDISSUANCE: activationBlock = params.MSC_DELEGATED_ISSUANCE_BLOCK; break; - case FEATURE_SEND_TO_MANY: - activationBlock = params.MSC_SEND_TO_MANY_BLOCK; + case FEATURE_SEND_TO_MANY_NFT_FIX: + activationBlock = params.MSC_SEND_TO_MANY_NFT_FIX_BLOCK; break; default: return false; diff --git a/src/omnicore/rules.h b/src/omnicore/rules.h index 8c88de6eb3cf77..a785f169d0f677 100644 --- a/src/omnicore/rules.h +++ b/src/omnicore/rules.h @@ -45,7 +45,7 @@ const uint16_t FEATURE_DELEGATEDISSUANCE = 17; //! Feature identifier to enable NFT issuer data update by issuers only const uint16_t FEATURE_NONFUNGIBLE_ISSUER = 18; //! Feature identifier to enable send-to-many support -const uint16_t FEATURE_SEND_TO_MANY = 19; +const uint16_t FEATURE_SEND_TO_MANY_NFT_FIX = 19; //! When (propertyTotalTokens / OMNI_FEE_THRESHOLD) is reached fee distribution will occur const int64_t OMNI_FEE_THRESHOLD = 100000; // 0.001% @@ -145,7 +145,7 @@ class CConsensusParams //! Block to enable delegation of token issuance int MSC_DELEGATED_ISSUANCE_BLOCK; //! Block to enable send-to-many - int MSC_SEND_TO_MANY_BLOCK; + int MSC_SEND_TO_MANY_NFT_FIX_BLOCK; //! Block to deactivate crowdsale participations when "granting tokens" int GRANTEFFECTS_FEATURE_BLOCK; diff --git a/src/omnicore/tx.cpp b/src/omnicore/tx.cpp index deb01cce484e25..17834a2372d582 100644 --- a/src/omnicore/tx.cpp +++ b/src/omnicore/tx.cpp @@ -1458,7 +1458,7 @@ int CMPTransaction::logicMath_SendAll() return (PKT_ERROR_SEND_ALL -22); } - if (!IsFeatureActivated(FEATURE_NONFUNGIBLE_ISSUER, block)) { + if (!IsFeatureActivated(FEATURE_SEND_TO_MANY_NFT_FIX, block)) { if (isPropertyNonFungible(property)) { PrintToLog("%s(): rejected: property %d is of type non-fungible\n", __func__, property); return (PKT_ERROR_NFT -21); @@ -1491,7 +1491,7 @@ int CMPTransaction::logicMath_SendAll() continue; } - if (IsFeatureActivated(FEATURE_NONFUNGIBLE_ISSUER, block)) { + if (IsFeatureActivated(FEATURE_SEND_TO_MANY_NFT_FIX, block)) { // do not transfer non-fungible tokens if (isPropertyNonFungible(propertyId)) { PrintToConsole("%s: property %d is non-fungible and will not be included in processing.\n", __func__, propertyId); @@ -3000,7 +3000,7 @@ int CMPTransaction::logicMath_NonFungibleData() sender, property); - if (IsFeatureActivated(FEATURE_NONFUNGIBLE_ISSUER, block)) { + if (IsFeatureActivated(FEATURE_SEND_TO_MANY_NFT_FIX, block)) { return (PKT_ERROR_NFT -31); } }