MCPcopy Create free account
hub / github.com/ElementsProject/elements / MempoolInfoToJSON

Function MempoolInfoToJSON

src/rpc/blockchain.cpp:2004–2020  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2002}
2003
2004UniValue MempoolInfoToJSON(const CTxMemPool& pool)
2005{
2006 // Make sure this call is atomic in the pool.
2007 LOCK(pool.cs);
2008 UniValue ret(UniValue::VOBJ);
2009 ret.pushKV("loaded", pool.IsLoaded());
2010 ret.pushKV("size", (int64_t)pool.size());
2011 ret.pushKV("bytes", (int64_t)pool.GetTotalTxSize());
2012 ret.pushKV("usage", (int64_t)pool.DynamicMemoryUsage());
2013 ret.pushKV("total_fee", ValueFromAmount(pool.GetTotalFee()));
2014 size_t maxmempool = gArgs.GetIntArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000;
2015 ret.pushKV("maxmempool", (int64_t) maxmempool);
2016 ret.pushKV("mempoolminfee", ValueFromAmount(std::max(pool.GetMinFee(maxmempool), ::minRelayTxFee).GetFeePerK()));
2017 ret.pushKV("minrelaytxfee", ValueFromAmount(::minRelayTxFee.GetFeePerK()));
2018 ret.pushKV("unbroadcastcount", uint64_t{pool.GetUnbroadcastTxs().size()});
2019 return ret;
2020}
2021
2022static RPCHelpMan getmempoolinfo()
2023{

Callers 2

rest_mempool_infoFunction · 0.85
getmempoolinfoFunction · 0.85

Calls 9

ValueFromAmountFunction · 0.85
IsLoadedMethod · 0.80
GetIntArgMethod · 0.80
GetFeePerKMethod · 0.80
GetMinFeeMethod · 0.80
GetUnbroadcastTxsMethod · 0.80
pushKVMethod · 0.45
sizeMethod · 0.45
DynamicMemoryUsageMethod · 0.45

Tested by

no test coverage detected