Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/blockchain.cpp
Show First 20 Lines • Show All 435 Lines • ▼ Show 20 Lines | void entryToJSON(UniValue &info, const CTxMemPoolEntry &e) { | ||||
info.push_back(Pair("depends", depends)); | info.push_back(Pair("depends", depends)); | ||||
} | } | ||||
UniValue mempoolToJSON(bool fVerbose = false) { | UniValue mempoolToJSON(bool fVerbose = false) { | ||||
if (fVerbose) { | if (fVerbose) { | ||||
LOCK(mempool.cs); | LOCK(mempool.cs); | ||||
UniValue o(UniValue::VOBJ); | UniValue o(UniValue::VOBJ); | ||||
for (const CTxMemPoolEntry &e : mempool.mapTx) { | for (const CTxMemPoolEntry &e : mempool.mapTx) { | ||||
const uint256 &txid = e.GetTx().GetHash(); | const TxHash &txhash = e.GetTx().GetHash(); | ||||
UniValue info(UniValue::VOBJ); | UniValue info(UniValue::VOBJ); | ||||
entryToJSON(info, e); | entryToJSON(info, e); | ||||
o.push_back(Pair(txid.ToString(), info)); | o.push_back(Pair(txhash.ToString(), info)); | ||||
} | } | ||||
return o; | return o; | ||||
} else { | } else { | ||||
std::vector<uint256> vtxids; | std::vector<TxHash> vtxhashes; | ||||
mempool.queryHashes(vtxids); | mempool.queryHashes(vtxhashes); | ||||
UniValue a(UniValue::VARR); | UniValue a(UniValue::VARR); | ||||
for (const uint256 &txid : vtxids) { | for (const TxHash &txhash : vtxhashes) { | ||||
a.push_back(txid.ToString()); | a.push_back(txhash.ToString()); | ||||
} | } | ||||
return a; | return a; | ||||
} | } | ||||
} | } | ||||
UniValue getrawmempool(const Config &config, const JSONRPCRequest &request) { | UniValue getrawmempool(const Config &config, const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() > 1) { | if (request.fHelp || request.params.size() > 1) { | ||||
▲ Show 20 Lines • Show All 1,202 Lines • Show Last 20 Lines |