Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/blockchain.cpp
Show First 20 Lines • Show All 1,009 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() != 0) { | ||||
HelpExampleCli("gettxoutsetinfo", "") + | HelpExampleCli("gettxoutsetinfo", "") + | ||||
HelpExampleRpc("gettxoutsetinfo", "")); | HelpExampleRpc("gettxoutsetinfo", "")); | ||||
} | } | ||||
UniValue ret(UniValue::VOBJ); | UniValue ret(UniValue::VOBJ); | ||||
CCoinsStats stats; | CCoinsStats stats; | ||||
FlushStateToDisk(); | FlushStateToDisk(); | ||||
if (GetUTXOStats(pcoinsdbview, stats)) { | if (GetUTXOStats(pcoinsdbview.get(), stats)) { | ||||
ret.push_back(Pair("height", int64_t(stats.nHeight))); | ret.push_back(Pair("height", int64_t(stats.nHeight))); | ||||
ret.push_back(Pair("bestblock", stats.hashBlock.GetHex())); | ret.push_back(Pair("bestblock", stats.hashBlock.GetHex())); | ||||
ret.push_back(Pair("transactions", int64_t(stats.nTransactions))); | ret.push_back(Pair("transactions", int64_t(stats.nTransactions))); | ||||
ret.push_back(Pair("txouts", int64_t(stats.nTransactionOutputs))); | ret.push_back(Pair("txouts", int64_t(stats.nTransactionOutputs))); | ||||
ret.push_back(Pair("bogosize", int64_t(stats.nBogoSize))); | ret.push_back(Pair("bogosize", int64_t(stats.nBogoSize))); | ||||
ret.push_back(Pair("hash_serialized", stats.hashSerialized.GetHex())); | ret.push_back(Pair("hash_serialized", stats.hashSerialized.GetHex())); | ||||
ret.push_back(Pair("disk_size", stats.nDiskSize)); | ret.push_back(Pair("disk_size", stats.nDiskSize)); | ||||
ret.push_back( | ret.push_back( | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | UniValue gettxout(const Config &config, const JSONRPCRequest &request) { | ||||
bool fMempool = true; | bool fMempool = true; | ||||
if (request.params.size() > 2) { | if (request.params.size() > 2) { | ||||
fMempool = request.params[2].get_bool(); | fMempool = request.params[2].get_bool(); | ||||
} | } | ||||
Coin coin; | Coin coin; | ||||
if (fMempool) { | if (fMempool) { | ||||
LOCK(mempool.cs); | LOCK(mempool.cs); | ||||
CCoinsViewMemPool view(pcoinsTip, mempool); | CCoinsViewMemPool view(pcoinsTip.get(), mempool); | ||||
if (!view.GetCoin(out, coin) || mempool.isSpent(out)) { | if (!view.GetCoin(out, coin) || mempool.isSpent(out)) { | ||||
// TODO: this should be done by the CCoinsViewMemPool | // TODO: this should be done by the CCoinsViewMemPool | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
} else { | } else { | ||||
if (!pcoinsTip->GetCoin(out, coin)) { | if (!pcoinsTip->GetCoin(out, coin)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | UniValue verifychain(const Config &config, const JSONRPCRequest &request) { | ||||
if (request.params.size() > 0) { | if (request.params.size() > 0) { | ||||
nCheckLevel = request.params[0].get_int(); | nCheckLevel = request.params[0].get_int(); | ||||
} | } | ||||
if (request.params.size() > 1) { | if (request.params.size() > 1) { | ||||
nCheckDepth = request.params[1].get_int(); | nCheckDepth = request.params[1].get_int(); | ||||
} | } | ||||
return CVerifyDB().VerifyDB(config, pcoinsTip, nCheckLevel, nCheckDepth); | return CVerifyDB().VerifyDB(config, pcoinsTip.get(), nCheckLevel, | ||||
nCheckDepth); | |||||
} | } | ||||
/** Implementation of IsSuperMajority with better feedback */ | /** Implementation of IsSuperMajority with better feedback */ | ||||
static UniValue SoftForkMajorityDesc(int version, CBlockIndex *pindex, | static UniValue SoftForkMajorityDesc(int version, CBlockIndex *pindex, | ||||
const Consensus::Params &consensusParams) { | const Consensus::Params &consensusParams) { | ||||
UniValue rv(UniValue::VOBJ); | UniValue rv(UniValue::VOBJ); | ||||
bool activated = false; | bool activated = false; | ||||
switch (version) { | switch (version) { | ||||
▲ Show 20 Lines • Show All 540 Lines • Show Last 20 Lines |