diff --git a/src/init.cpp b/src/init.cpp index cadccbd95f..1873db4497 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -614,6 +614,8 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-elysiumshowblockconsensushash=", "Calculate and log the consensus hash for the specified block"); #endif + strUsage += HelpMessageOpt("-skipmnpayoutcheck", _("Do not check for masternode payout when handling listtransactions, listsinceblock and gettransaction calls (improves performance)")); + return strUsage; } @@ -1403,6 +1405,7 @@ bool AppInitParameterInteraction() } } } + fSkipMnpayoutCheck = GetBoolArg("-skipmnpayoutcheck", false); return true; } diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp index 219a0bc202..e4b1526809 100644 --- a/src/rpc/client.cpp +++ b/src/rpc/client.cpp @@ -68,7 +68,6 @@ static const CRPCConvertParam vRPCConvertParams[] = { "listtransactions", 1, "count" }, { "listtransactions", 2, "skip" }, { "listtransactions", 3, "include_watchonly" }, - { "listtransactions", 4, "skip_mnout_check" }, { "listaccounts", 0, "minconf" }, { "listaccounts", 1, "include_watchonly" }, { "walletpassphrase", 1, "timeout" }, diff --git a/src/util.cpp b/src/util.cpp index bb4b630b81..5f57ffa6cc 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -126,6 +126,7 @@ bool fLogTimestamps = DEFAULT_LOGTIMESTAMPS; bool fLogTimeMicros = DEFAULT_LOGTIMEMICROS; bool fLogIPs = DEFAULT_LOGIPS; +bool fSkipMnpayoutCheck = false; std::atomic fReopenDebugLog(false); CTranslationInterface translationInterface; diff --git a/src/util.h b/src/util.h index 507d0cd779..400c7980b6 100644 --- a/src/util.h +++ b/src/util.h @@ -69,6 +69,7 @@ extern std::atomic fReopenElysiumLog; extern const char * const BITCOIN_CONF_FILENAME; extern const char * const BITCOIN_PID_FILENAME; +extern bool fSkipMnpayoutCheck; /** * Translation function: Call Translate signal on UI interface, which returns a boost::optional result. diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index be0ecfb054..1b0e956d04 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1485,7 +1485,7 @@ static void MaybePushAddress(UniValue & entry, const CTxDestination &dest, CBitc entry.push_back(Pair("address", addr.ToString())); } -void ListTransactions(CWallet * const pwallet, const CWalletTx& wtx, const string& strAccount, int nMinDepth, bool fLong, UniValue& ret, const isminefilter& filter, bool omitNmPayments) +void ListTransactions(CWallet * const pwallet, const CWalletTx& wtx, const string& strAccount, int nMinDepth, bool fLong, UniValue& ret, const isminefilter& filter) { CAmount nFee; string strSentAccount; @@ -1553,8 +1553,7 @@ void ListTransactions(CWallet * const pwallet, const CWalletTx& wtx, const strin int txHeight = chainActive.Height() - wtx.GetDepthInMainChain(); bool its_znode_payment = false; - - if (!omitNmPayments) { + if (!fSkipMnpayoutCheck) { std::vector voutMasternodePaymentsRet; mnpayments.GetBlockTxOuts(txHeight, CAmount(), voutMasternodePaymentsRet); //compare address of payee to addr. @@ -1618,7 +1617,7 @@ UniValue listtransactions(const JSONRPCRequest& request) return NullUniValue; } - if (request.fHelp || request.params.size() > 5) + if (request.fHelp || request.params.size() > 4) throw runtime_error( "listtransactions ( \"account\" count skip include_watchonly)\n" "\nReturns up to 'count' most recent transactions skipping the first 'from' transactions for account 'account'.\n" @@ -1627,7 +1626,6 @@ UniValue listtransactions(const JSONRPCRequest& request) "2. count (numeric, optional, default=10) The number of transactions to return\n" "3. skip (numeric, optional, default=0) The number of transactions to skip\n" "4. include_watchonly (bool, optional, default=false) Include transactions to watch-only addresses (see 'importaddress')\n" - "5. skip_mnout_check (bool, optional, default=false) Skip checking for masternode payment txout (improves performance)\n" "\nResult:\n" "[\n" " {\n" @@ -1694,9 +1692,6 @@ UniValue listtransactions(const JSONRPCRequest& request) if(request.params.size() > 3) if(request.params[3].get_bool()) filter = filter | ISMINE_WATCH_ONLY; - bool omitNmPayments = false; - if(request.params.size() > 4) - omitNmPayments = request.params[4].get_bool(); if (nCount < 0) throw JSONRPCError(RPC_INVALID_PARAMETER, "Negative count"); @@ -1712,7 +1707,7 @@ UniValue listtransactions(const JSONRPCRequest& request) { CWalletTx *const pwtx = (*it).second.first; if (pwtx != 0) - ListTransactions(pwallet, *pwtx, strAccount, 0, true, ret, filter, omitNmPayments); + ListTransactions(pwallet, *pwtx, strAccount, 0, true, ret, filter); CAccountingEntry *const pacentry = (*it).second.second; if (pacentry != 0) AcentryToJSON(*pacentry, strAccount, ret); @@ -1921,7 +1916,7 @@ UniValue listsinceblock(const JSONRPCRequest& request) CWalletTx tx = pairWtx.second; if (depth == -1 || tx.GetDepthInMainChain() < depth) - ListTransactions(pwallet, tx, "*", 0, true, transactions, filter, false); + ListTransactions(pwallet, tx, "*", 0, true, transactions, filter); } CBlockIndex *pblockLast = chainActive[chainActive.Height() + 1 - target_confirms]; @@ -2017,7 +2012,7 @@ UniValue gettransaction(const JSONRPCRequest& request) WalletTxToJSON(wtx, entry); UniValue details(UniValue::VARR); - ListTransactions(pwallet, wtx, "*", 0, false, details, filter, false); + ListTransactions(pwallet, wtx, "*", 0, false, details, filter); entry.push_back(Pair("details", details)); string strHex = EncodeHexTx(static_cast(wtx), RPCSerializationFlags());