add litemode information to help texts regarding CL/IS and change getbestchainlock to throw an error if running in litemode (#3478)

Signed-off-by: Pasta <pasta@dashboost.org>
This commit is contained in:
PastaPastaPasta 2020-05-14 20:10:58 +00:00 committed by GitHub
parent 5cabc8f5ca
commit f46617dbab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 15 deletions

View File

@ -225,7 +225,8 @@ UniValue getbestchainlock(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"getbestchainlock\n"
"\nReturns the block hash of the best chainlock. Throws an error if there is no known chainlock yet.\n"
"\nReturns the block hash of the best chainlock. Throws an error if there is no known chainlock yet. "
"Will throw an error if running in litemode.\n"
"\nResult:\n"
"{\n"
" \"blockhash\" : \"hash\", (string) The block hash hex encoded\n"
@ -237,6 +238,11 @@ UniValue getbestchainlock(const JSONRPCRequest& request)
+ HelpExampleRpc("getbestchainlock", "")
);
UniValue result(UniValue::VOBJ);
if (fLiteMode) {
throw JSONRPCError(RPC_INTERNAL_ERROR, "Chainlock information not available in litemode.");
}
llmq::CChainLockSig clsig = llmq::chainLocksHandler->GetBestChainLock();
if (clsig.IsNull()) {
throw JSONRPCError(RPC_INTERNAL_ERROR, "Unable to find any chainlock");
@ -413,7 +419,7 @@ std::string EntryDescriptionString()
" \"depends\" : [ (array) unconfirmed transactions used as inputs for this transaction\n"
" \"transactionid\", (string) parent transaction id\n"
" ... ],\n"
" \"instantlock\" : true|false (boolean) True if this transaction was locked via InstantSend\n";
" \"instantlock\" : true|false (boolean) True if this transaction was locked via InstantSend. Always false if litemode is enabled\n";
}
void entryToJSON(UniValue &info, const CTxMemPoolEntry &e)
@ -1675,7 +1681,7 @@ UniValue getmempoolinfo(const JSONRPCRequest& request)
" \"maxmempool\": xxxxx, (numeric) Maximum memory usage for the mempool\n"
" \"mempoolminfee\": xxxxx (numeric) Minimum fee rate in " + CURRENCY_UNIT + "/kB for tx to be accepted. Is the maximum of minrelaytxfee and minimum mempool fee\n"
" \"minrelaytxfee\": xxxxx (numeric) Current minimum relay fee for transactions\n"
" \"instantsendlocks\": xxxxx, (numeric) Number of unconfirmed instant send locks\n"
" \"instantsendlocks\": xxxxx, (numeric) Number of unconfirmed instant send locks. Always 0 if litemode is enabled\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("getmempoolinfo", "")

View File

@ -171,9 +171,9 @@ UniValue getrawtransaction(const JSONRPCRequest& request)
" \"confirmations\" : n, (numeric) The confirmations\n"
" \"time\" : ttt, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT)\n"
" \"blocktime\" : ttt (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n"
" \"instantlock\" : true|false, (bool) Current transaction lock state\n"
" \"instantlock_internal\" : true|false, (bool) Current internal transaction lock state\n"
" \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock\n"
" \"instantlock\" : true|false, (bool) Current transaction lock state. Always false if litemode is enabled\n"
" \"instantlock_internal\" : true|false, (bool) Current internal transaction lock state. Always false if litemode is enabled\n"
" \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock. Always false if litemode is enabled\n"
"}\n"
"\nExamples:\n"

View File

@ -1651,9 +1651,9 @@ UniValue listtransactions(const JSONRPCRequest& request)
" \"confirmations\": n, (numeric) The number of blockchain confirmations for the transaction. Available for 'send' and \n"
" 'receive' category of transactions. Negative confirmations indicate the\n"
" transation conflicts with the block chain\n"
" \"instantlock\" : true|false, (bool) Current transaction lock state. Available for 'send' and 'receive' category of transactions.\n"
" \"instantlock_internal\" : true|false, (bool) Current internal transaction lock state. Available for 'send' and 'receive' category of transactions.\n"
" \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock\n"
" \"instantlock\" : true|false, (bool) Current transaction lock state. Available for 'send' and 'receive' category of transactions. Always false if litemode is enabled\n"
" \"instantlock_internal\" : true|false, (bool) Current internal transaction lock state. Available for 'send' and 'receive' category of transactions. Always false if litemode is enabled\n"
" \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock. Always false if litemode is enabled\n"
" \"trusted\": xxx, (bool) Whether we consider the outputs of this unconfirmed transaction safe to spend.\n"
" \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive'\n"
" category of transactions.\n"
@ -1874,9 +1874,9 @@ UniValue listsinceblock(const JSONRPCRequest& request)
" \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the 'send' category of transactions.\n"
" \"confirmations\" : n, (numeric) The number of blockchain confirmations for the transaction. Available for 'send' and 'receive' category of transactions.\n"
" When it's < 0, it means the transaction conflicted that many blocks ago.\n"
" \"instantlock\" : true|false, (bool) Current transaction lock state. Available for 'send' and 'receive' category of transactions.\n"
" \"instantlock_internal\" : true|false, (bool) Current internal transaction lock state. Available for 'send' and 'receive' category of transactions.\n"
" \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock\n"
" \"instantlock\" : true|false, (bool) Current transaction lock state. Available for 'send' and 'receive' category of transactions. Always false if litemode is enabled\n"
" \"instantlock_internal\" : true|false, (bool) Current internal transaction lock state. Available for 'send' and 'receive' category of transactions. Always false if litemode is enabled\n"
" \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock. Always false if litemode is enabled\n"
" \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive' category of transactions.\n"
" \"blockindex\": n, (numeric) The index of the transaction in the block that includes it. Available for 'send' and 'receive' category of transactions.\n"
" \"blocktime\": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).\n"
@ -2005,9 +2005,9 @@ UniValue gettransaction(const JSONRPCRequest& request)
" \"amount\" : x.xxx, (numeric) The transaction amount in " + CURRENCY_UNIT + "\n"
" \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n"
" 'send' category of transactions.\n"
" \"instantlock\" : true|false, (bool) Current transaction lock state\n"
" \"instantlock_internal\" : true|false, (bool) Current internal transaction lock state\n"
" \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock\n"
" \"instantlock\" : true|false, (bool) Current transaction lock state. Always false if litemode is enabled\n"
" \"instantlock_internal\" : true|false, (bool) Current internal transaction lock state. Always false if litemode is enabled\n"
" \"chainlock\" : true|false, (bool) The state of the corresponding block chainlock. Always false if litemode is enabled\n"
" \"confirmations\" : n, (numeric) The number of blockchain confirmations\n"
" \"blockhash\" : \"hash\", (string) The block hash\n"
" \"blockindex\" : xx, (numeric) The index of the transaction in the block that includes it\n"