diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index e1349acdb..010af32da 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -82,6 +82,11 @@ Object blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool txDe result.push_back(Pair("nonce", (uint64_t)block.nNonce)); result.push_back(Pair("bits", strprintf("%08x", block.nBits))); result.push_back(Pair("difficulty", GetDifficulty(blockindex))); + bool fNegative; + bool fOverflow; + arith_uint256 target; + target.SetCompact(block.nBits, &fNegative, &fOverflow); + result.push_back(Pair("target", target.ToString())); result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex())); if (blockindex->pprev) diff --git a/src/rpcncctrie.cpp b/src/rpcncctrie.cpp index 947be9f36..5778ef1e5 100644 --- a/src/rpcncctrie.cpp +++ b/src/rpcncctrie.cpp @@ -1,5 +1,6 @@ #include "main.h" #include "ncc.h" +#include "rpcserver.h" #include "json/json_spirit_value.h" @@ -118,15 +119,12 @@ Value gettotalclaimednames(const Array& params, bool fHelp) " names in the trie\n" ); LOCK(cs_main); - Object ret; if (!pnccTrie) { - ret.push_back(Pair("total names", -1)); - return ret; + return -1; } unsigned int num_names = pnccTrie->getTotalNamesInTrie(); - ret.push_back(Pair("total names", (int)num_names)); - return ret; + return int(num_names); } Value gettotalclaims(const Array& params, bool fHelp) @@ -141,15 +139,12 @@ Value gettotalclaims(const Array& params, bool fHelp) " of active claims\n" ); LOCK(cs_main); - Object ret; if (!pnccTrie) { - ret.push_back(Pair("total claims", -1)); - return ret; + return -1; } unsigned int num_claims = pnccTrie->getTotalClaimsInTrie(); - ret.push_back(Pair("total claims", (int)num_claims)); - return ret; + return int(num_claims); } Value gettotalvalueofclaims(const Array& params, bool fHelp) @@ -166,17 +161,14 @@ Value gettotalvalueofclaims(const Array& params, bool fHelp) " claims in the trie\n" ); LOCK(cs_main); - Object ret; if (!pnccTrie) { - ret.push_back(Pair("total value", -1)); - return ret; + return -1; } bool controlling_only = false; if (params.size() == 1) controlling_only = params[0].get_bool(); CAmount total_amount = pnccTrie->getTotalValueOfClaimsInTrie(controlling_only); - ret.push_back(Pair("total value", total_amount)); - return ret; + return ValueFromAmount(total_amount); }