Commit 69b2dc19 authored by artem-bv's avatar artem-bv

add nft_tx spork, on by default

parent 91ca83d9
......@@ -958,6 +958,10 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state)
// check version 3 transaction types
if (tx.nVersion >= 3)
{
if (!IsSporkActive(SPORK_17_NFT_TX))
{
return state.DoS(100, false, REJECT_INVALID, "nft-tx-spork-off");
}
if (tx.nType != TRANSACTION_NORMAL &&
tx.nType != TRANSACTION_GOVERNANCE_VOTE &&
tx.nType != TRANSACTION_NF_TOKEN_REGISTER &&
......@@ -970,7 +974,9 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state)
}
// all version 1 transactions are normal
else if (tx.nType != TRANSACTION_NORMAL)
{
return state.DoS(100, false, REJECT_INVALID, "bad-txns-type");
}
// Basic checks that don't depend on any context
if (tx.vin.empty())
......
......@@ -2,6 +2,7 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <spork.h>
#include <platform/nf-token/nf-token-protocol.h>
#include "primitives/transaction.h"
#include "platform/specialtx.h"
......@@ -14,6 +15,11 @@
json_spirit::Value nftoken(const json_spirit::Array& params, bool fHelp)
{
if (!IsSporkActive(SPORK_17_NFT_TX))
{
throw std::runtime_error("NFT spork is off");
}
std::string command = Platform::GetCommand(params, "usage: nftoken register(issue)|list|get|getbytxid|totalsupply|balanceof|ownerof");
if (command == "register" || command == "issue")
......
......@@ -2,6 +2,7 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <spork.h>
#include "platform/nf-token/nf-token-protocol.h"
#include "platform/nf-token/nft-protocol-reg-tx-builder.h"
#include "platform/nf-token/nft-protocols-manager.h"
......@@ -14,6 +15,11 @@
json_spirit::Value nftproto(const json_spirit::Array& params, bool fHelp)
{
if (!IsSporkActive(SPORK_17_NFT_TX))
{
throw std::runtime_error("NFT spork is off");
}
std::string command = Platform::GetCommand(params, "usage: nftproto register|list|get|getbytxid|ownerof");
if (command == "register")
......
......@@ -97,6 +97,7 @@ bool IsSporkActive(int nSporkID)
if(nSporkID == SPORK_14_SYSTEMNODE_PAYMENT_ENFORCEMENT) r = SPORK_14_SYSTEMNODE_PAYMENT_ENFORCEMENT_DEFAULT;
if(nSporkID == SPORK_15_SYSTEMNODE_DONT_PAY_OLD_NODES) r = SPORK_15_SYSTEMNODE_DONT_PAY_OLD_NODES_DEFAULT;
if(nSporkID == SPORK_16_DISCONNECT_OLD_NODES) r = SPORK_16_DISCONNECT_OLD_NODES_DEFAULT;
if(nSporkID == SPORK_17_NFT_TX) r = SPORK_17_NFT_TX_DEFAULT;
if(r == -1) LogPrintf("GetSpork::Unknown Spork %d\n", nSporkID);
}
......@@ -127,6 +128,7 @@ int64_t GetSporkValue(int nSporkID)
if(nSporkID == SPORK_14_SYSTEMNODE_PAYMENT_ENFORCEMENT) r = SPORK_14_SYSTEMNODE_PAYMENT_ENFORCEMENT_DEFAULT;
if(nSporkID == SPORK_15_SYSTEMNODE_DONT_PAY_OLD_NODES) r = SPORK_15_SYSTEMNODE_DONT_PAY_OLD_NODES_DEFAULT;
if(nSporkID == SPORK_16_DISCONNECT_OLD_NODES) r = SPORK_16_DISCONNECT_OLD_NODES_DEFAULT;
if(nSporkID == SPORK_17_NFT_TX) r = SPORK_17_NFT_TX_DEFAULT;
if(r == -1) LogPrintf("GetSpork::Unknown Spork %d\n", nSporkID);
}
......@@ -288,6 +290,7 @@ int CSporkManager::GetSporkIDByName(std::string strName)
if(strName == "SPORK_14_SYSTEMNODE_PAYMENT_ENFORCEMENT") return SPORK_14_SYSTEMNODE_PAYMENT_ENFORCEMENT;
if(strName == "SPORK_15_SYSTEMNODE_PAY_UPDATED_NODES") return SPORK_15_SYSTEMNODE_DONT_PAY_OLD_NODES;
if(strName == "SPORK_16_DISCONNECT_OLD_NODES") return SPORK_16_DISCONNECT_OLD_NODES;
if(strName == "SPORK_17_NFT_TX") return SPORK_17_NFT_TX;
return -1;
}
......@@ -308,6 +311,7 @@ std::string CSporkManager::GetSporkNameByID(int id)
if(id == SPORK_14_SYSTEMNODE_PAYMENT_ENFORCEMENT) return "SPORK_14_SYSTEMNODE_PAYMENT_ENFORCEMENT";
if(id == SPORK_15_SYSTEMNODE_DONT_PAY_OLD_NODES) return "SPORK_15_SYSTEMNODE_PAY_UPDATED_NODES";
if(id == SPORK_16_DISCONNECT_OLD_NODES) return "SPORK_16_DISCONNECT_OLD_NODES";
if(id == SPORK_17_NFT_TX) return "SPORK_17_NFT_TX";
return "Unknown";
}
......@@ -40,6 +40,7 @@ using namespace boost;
#define SPORK_14_SYSTEMNODE_PAYMENT_ENFORCEMENT 10013
#define SPORK_15_SYSTEMNODE_DONT_PAY_OLD_NODES 10014
#define SPORK_16_DISCONNECT_OLD_NODES 10015
#define SPORK_17_NFT_TX 10016
#define SPORK_2_INSTANTX_DEFAULT 978307200 //2001-1-1
#define SPORK_3_INSTANTX_BLOCK_FILTERING_DEFAULT 1424217600 //2015-2-18
......@@ -55,6 +56,7 @@ using namespace boost;
#define SPORK_14_SYSTEMNODE_PAYMENT_ENFORCEMENT_DEFAULT 4070908800 //OFF
#define SPORK_15_SYSTEMNODE_DONT_PAY_OLD_NODES_DEFAULT 4070908800 //OFF
#define SPORK_16_DISCONNECT_OLD_NODES_DEFAULT 4070908800 //OFF
#define SPORK_17_NFT_TX_DEFAULT 1582992203 //2020-2-29
class CSporkMessage;
class CSporkManager;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment