| 175 | } |
| 176 | |
| 177 | UniValue mempoolToJSON(bool fVerbose = false) |
| 178 | { |
| 179 | if (fVerbose) |
| 180 | { |
| 181 | LOCK(mempool.cs); |
| 182 | UniValue o(UniValue::VOBJ); |
| 183 | BOOST_FOREACH(const CTxMemPoolEntry& e, mempool.mapTx) |
| 184 | { |
| 185 | const uint256& hash = e.GetTx().GetHash(); |
| 186 | UniValue info(UniValue::VOBJ); |
| 187 | info.push_back(Pair("size", (int)e.GetTxSize())); |
| 188 | info.push_back(Pair("fee", ValueFromAmount(e.GetFee()))); |
| 189 | info.push_back(Pair("time", e.GetTime())); |
| 190 | info.push_back(Pair("height", (int)e.GetHeight())); |
| 191 | info.push_back(Pair("startingpriority", e.GetPriority(e.GetHeight()))); |
| 192 | info.push_back(Pair("currentpriority", e.GetPriority(chainActive.Height()))); |
| 193 | info.push_back(Pair("descendantcount", e.GetCountWithDescendants())); |
| 194 | info.push_back(Pair("descendantsize", e.GetSizeWithDescendants())); |
| 195 | info.push_back(Pair("descendantfees", e.GetFeesWithDescendants())); |
| 196 | const CTransaction& tx = e.GetTx(); |
| 197 | set<string> setDepends; |
| 198 | BOOST_FOREACH(const CTxIn& txin, tx.vin) |
| 199 | { |
| 200 | if (mempool.exists(txin.prevout.hash)) |
| 201 | setDepends.insert(txin.prevout.hash.ToString()); |
| 202 | } |
| 203 | |
| 204 | UniValue depends(UniValue::VARR); |
| 205 | BOOST_FOREACH(const string& dep, setDepends) |
| 206 | { |
| 207 | depends.push_back(dep); |
| 208 | } |
| 209 | |
| 210 | info.push_back(Pair("depends", depends)); |
| 211 | o.push_back(Pair(hash.ToString(), info)); |
| 212 | } |
| 213 | return o; |
| 214 | } |
| 215 | else |
| 216 | { |
| 217 | vector<uint256> vtxid; |
| 218 | mempool.queryHashes(vtxid); |
| 219 | |
| 220 | UniValue a(UniValue::VARR); |
| 221 | BOOST_FOREACH(const uint256& hash, vtxid) |
| 222 | a.push_back(hash.ToString()); |
| 223 | |
| 224 | return a; |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | UniValue getrawmempool(const UniValue& params, bool fHelp) |
| 229 | { |
no test coverage detected