From aff97f9fd4be59a7f0b2ae98fd563fcf1a8977b6 Mon Sep 17 00:00:00 2001 From: dimxy Date: Mon, 29 Apr 2019 13:05:27 +0500 Subject: [PATCH] added check for non-fungible data --- src/cc/CCtokens.cpp | 6 ++++++ src/wallet/rpcwallet.cpp | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/cc/CCtokens.cpp b/src/cc/CCtokens.cpp index be3cbd922..5f5e56ebb 100644 --- a/src/cc/CCtokens.cpp +++ b/src/cc/CCtokens.cpp @@ -937,6 +937,12 @@ UniValue TokenInfo(uint256 tokenid) result.push_back(Pair("error", "cant find tokenid")); return(result); } + if (hashBlock.IsNull()) { + result.push_back(Pair("result", "error")); + result.push_back(Pair("error", "the transaction is still in mempool")); + return(result); + } + if (tokenbaseTx.vout.size() > 0 && DecodeTokenCreateOpRet(tokenbaseTx.vout[tokenbaseTx.vout.size() - 1].scriptPubKey, origpubkey, name, description, oprets) != 'c') { LOGSTREAM((char *)"cctokens", CCLOG_INFO, stream << "TokenInfo() passed tokenid isnt token creation txid" << std::endl); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 6fe061727..c830d37f9 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -7276,9 +7276,13 @@ UniValue tokencreate(const UniValue& params, bool fHelp) if (params.size() == 4) { nonfungibleData = ParseHex(params[3].get_str()); - if (nonfungibleData.size() > 10000) // opret limit + if (nonfungibleData.size() > IGUANA_MAXSCRIPTSIZE) // opret limit { - ERR_RESULT("Non-fungible data must be <= 10000"); + ERR_RESULT("Non-fungible data size must be <= " + std::to_string(IGUANA_MAXSCRIPTSIZE)); + return(result); + } + if( nonfungibleData.empty() ) { + ERR_RESULT("Non-fungible data incorrect"); return(result); } }