Remove redefined functions
rpc/blockchain.cpp
This commit is contained in:
@@ -63,37 +63,6 @@ double GetDifficulty(const CBlockIndex* blockindex)
|
||||
return dDiff;
|
||||
}
|
||||
|
||||
UniValue blockheaderToJSON(const CBlockIndex* blockindex)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ);
|
||||
result.push_back(Pair("hash", blockindex->GetBlockHash().GetHex()));
|
||||
int confirmations = -1;
|
||||
// Only report confirmations if the block is on the main chain
|
||||
if (chainActive.Contains(blockindex))
|
||||
confirmations = chainActive.Height() - blockindex->nHeight + 1;
|
||||
result.push_back(Pair("confirmations", confirmations));
|
||||
result.push_back(Pair("height", blockindex->nHeight));
|
||||
result.push_back(Pair("version", blockindex->nVersion));
|
||||
result.push_back(Pair("versionHex", strprintf("%08x", blockindex->nVersion)));
|
||||
result.push_back(Pair("merkleroot", blockindex->hashMerkleRoot.GetHex()));
|
||||
result.push_back(Pair("time", (int64_t)blockindex->nTime));
|
||||
result.push_back(Pair("mediantime", (int64_t)blockindex->GetPastTimeLimit()));
|
||||
result.push_back(Pair("nonce", (uint64_t)blockindex->nNonce));
|
||||
result.push_back(Pair("bits", strprintf("%08x", blockindex->nBits)));
|
||||
result.push_back(Pair("difficulty", GetDifficulty(blockindex)));
|
||||
result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex()));
|
||||
result.push_back(Pair("modifier", blockindex->nStakeModifier.GetHex()));
|
||||
|
||||
if (blockindex->pprev)
|
||||
result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex()));
|
||||
CBlockIndex *pnext = chainActive.Next(blockindex);
|
||||
if (pnext)
|
||||
result.push_back(Pair("nextblockhash", pnext->GetBlockHash().GetHex()));
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
double GetPoSKernelPS()
|
||||
{
|
||||
int nPoSInterval = 72;
|
||||
@@ -129,6 +98,37 @@ double GetPoSKernelPS()
|
||||
return result;
|
||||
}
|
||||
|
||||
UniValue blockheaderToJSON(const CBlockIndex* blockindex)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ);
|
||||
result.push_back(Pair("hash", blockindex->GetBlockHash().GetHex()));
|
||||
int confirmations = -1;
|
||||
// Only report confirmations if the block is on the main chain
|
||||
if (chainActive.Contains(blockindex))
|
||||
confirmations = chainActive.Height() - blockindex->nHeight + 1;
|
||||
result.push_back(Pair("confirmations", confirmations));
|
||||
result.push_back(Pair("height", blockindex->nHeight));
|
||||
result.push_back(Pair("version", blockindex->nVersion));
|
||||
result.push_back(Pair("versionHex", strprintf("%08x", blockindex->nVersion)));
|
||||
result.push_back(Pair("merkleroot", blockindex->hashMerkleRoot.GetHex()));
|
||||
result.push_back(Pair("time", (int64_t)blockindex->nTime));
|
||||
result.push_back(Pair("mediantime", (int64_t)blockindex->GetPastTimeLimit()));
|
||||
result.push_back(Pair("nonce", (uint64_t)blockindex->nNonce));
|
||||
result.push_back(Pair("bits", strprintf("%08x", blockindex->nBits)));
|
||||
result.push_back(Pair("difficulty", GetDifficulty(blockindex)));
|
||||
result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex()));
|
||||
result.push_back(Pair("modifier", blockindex->nStakeModifier.GetHex()));
|
||||
|
||||
if (blockindex->pprev)
|
||||
result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex()));
|
||||
CBlockIndex *pnext = chainActive.Next(blockindex);
|
||||
if (pnext)
|
||||
result.push_back(Pair("nextblockhash", pnext->GetBlockHash().GetHex()));
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool txDetails = false)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ);
|
||||
@@ -211,19 +211,19 @@ UniValue getbestblockhash(const UniValue& params, bool fHelp)
|
||||
|
||||
UniValue getdifficulty(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() != 0)
|
||||
throw runtime_error(
|
||||
"getdifficulty\n"
|
||||
"\nReturns the difficulty as a multiple of the minimum difficulty.\n"
|
||||
"\nResult:\n"
|
||||
"{ (json object)\n"
|
||||
" \"proof-of-work\" : n.nnn, (numeric) the proof-of-work difficulty as a multiple of the minimum difficulty.\n"
|
||||
" \"proof-of-stake\" : n.nnn (numeric) the proof-of-stake difficulty as a multiple of the minimum difficulty.\n"
|
||||
"}\n"
|
||||
"\nExamples:\n"
|
||||
+ HelpExampleCli("getdifficulty", "")
|
||||
+ HelpExampleRpc("getdifficulty", "")
|
||||
);
|
||||
if (fHelp || params.size() != 0)
|
||||
throw runtime_error(
|
||||
"getdifficulty\n"
|
||||
"\nReturns the difficulty as a multiple of the minimum difficulty.\n"
|
||||
"\nResult:\n"
|
||||
"{ (json object)\n"
|
||||
" \"proof-of-work\" : n.nnn, (numeric) the proof-of-work difficulty as a multiple of the minimum difficulty.\n"
|
||||
" \"proof-of-stake\" : n.nnn (numeric) the proof-of-stake difficulty as a multiple of the minimum difficulty.\n"
|
||||
"}\n"
|
||||
"\nExamples:\n"
|
||||
+ HelpExampleCli("getdifficulty", "")
|
||||
+ HelpExampleRpc("getdifficulty", "")
|
||||
);
|
||||
|
||||
LOCK(cs_main);
|
||||
|
||||
@@ -233,54 +233,6 @@ UniValue getdifficulty(const UniValue& params, bool fHelp)
|
||||
return obj;
|
||||
}
|
||||
|
||||
std::string EntryDescriptionString()
|
||||
{
|
||||
return " \"size\" : n, (numeric) transaction size in bytes\n"
|
||||
" \"fee\" : n, (numeric) transaction fee in " + CURRENCY_UNIT + "\n"
|
||||
" \"modifiedfee\" : n, (numeric) transaction fee with fee deltas used for mining priority\n"
|
||||
" \"time\" : n, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT\n"
|
||||
" \"height\" : n, (numeric) block height when transaction entered pool\n"
|
||||
" \"startingpriority\" : n, (numeric) priority when transaction entered pool\n"
|
||||
" \"currentpriority\" : n, (numeric) transaction priority now\n"
|
||||
" \"descendantcount\" : n, (numeric) number of in-mempool descendant transactions (including this one)\n"
|
||||
" \"descendantsize\" : n, (numeric) size of in-mempool descendants (including this one)\n"
|
||||
" \"descendantfees\" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one)\n"
|
||||
" \"depends\" : [ (array) unconfirmed transactions used as inputs for this transaction\n"
|
||||
" \"transactionid\", (string) parent transaction id\n"
|
||||
" ... ]\n";
|
||||
}
|
||||
|
||||
void entryToJSON(UniValue &info, const CTxMemPoolEntry &e)
|
||||
{
|
||||
AssertLockHeld(mempool.cs);
|
||||
|
||||
info.push_back(Pair("size", (int)e.GetTxSize()));
|
||||
info.push_back(Pair("fee", ValueFromAmount(e.GetFee())));
|
||||
info.push_back(Pair("modifiedfee", ValueFromAmount(e.GetModifiedFee())));
|
||||
info.push_back(Pair("time", e.GetTime()));
|
||||
info.push_back(Pair("height", (int)e.GetHeight()));
|
||||
info.push_back(Pair("startingpriority", e.GetPriority(e.GetHeight())));
|
||||
info.push_back(Pair("currentpriority", e.GetPriority(chainActive.Height())));
|
||||
info.push_back(Pair("descendantcount", e.GetCountWithDescendants()));
|
||||
info.push_back(Pair("descendantsize", e.GetSizeWithDescendants()));
|
||||
info.push_back(Pair("descendantfees", e.GetModFeesWithDescendants()));
|
||||
const CTransaction& tx = e.GetTx();
|
||||
set<string> setDepends;
|
||||
BOOST_FOREACH(const CTxIn& txin, tx.vin)
|
||||
{
|
||||
if (mempool.exists(txin.prevout.hash))
|
||||
setDepends.insert(txin.prevout.hash.ToString());
|
||||
}
|
||||
|
||||
UniValue depends(UniValue::VARR);
|
||||
BOOST_FOREACH(const string& dep, setDepends)
|
||||
{
|
||||
depends.push_back(dep);
|
||||
}
|
||||
|
||||
info.push_back(Pair("depends", depends));
|
||||
}
|
||||
|
||||
std::string EntryDescriptionString()
|
||||
{
|
||||
return " \"size\" : n, (numeric) transaction size in bytes\n"
|
||||
|
||||
Reference in New Issue
Block a user