rpc: Replace boolean argument for tx details with enum class.

Co-authored-by: Luke Dashjr <luke_github1@dashjr.org>
Co-authored-by: 0xB10C <19157360+0xB10C@users.noreply.github.com>
This commit is contained in:
fyquah
2021-03-01 20:03:35 +00:00
committed by Kiminuo
parent 816e15ee81
commit 3cc95345ca
5 changed files with 46 additions and 25 deletions

View File

@@ -260,7 +260,7 @@ static bool rest_headers(const std::any& context,
static bool rest_block(const std::any& context,
HTTPRequest* req,
const std::string& strURIPart,
bool showTxDetails)
TxVerbosity tx_verbosity)
{
if (!CheckWarmup(req))
return false;
@@ -312,7 +312,7 @@ static bool rest_block(const std::any& context,
}
case RetFormat::JSON: {
UniValue objBlock = blockToJSON(block, tip, pblockindex, showTxDetails);
UniValue objBlock = blockToJSON(block, tip, pblockindex, tx_verbosity);
std::string strJSON = objBlock.write() + "\n";
req->WriteHeader("Content-Type", "application/json");
req->WriteReply(HTTP_OK, strJSON);
@@ -327,12 +327,12 @@ static bool rest_block(const std::any& context,
static bool rest_block_extended(const std::any& context, HTTPRequest* req, const std::string& strURIPart)
{
return rest_block(context, req, strURIPart, true);
return rest_block(context, req, strURIPart, TxVerbosity::SHOW_DETAILS);
}
static bool rest_block_notxdetails(const std::any& context, HTTPRequest* req, const std::string& strURIPart)
{
return rest_block(context, req, strURIPart, false);
return rest_block(context, req, strURIPart, TxVerbosity::SHOW_TXID);
}
// A bit of a hack - dependency on a function defined in rpc/blockchain.cpp