diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-08-26 16:23:31 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-08-26 16:23:31 +0100 |
commit | 55bec1f03db039e03bfccec24c88ff08b15b6381 (patch) | |
tree | 308a12af39b884c63eeec58aa26e076f2e622de3 /src/cryptonote_core/tx_pool.cpp | |
parent | Merge pull request #2311 (diff) | |
download | monero-55bec1f03db039e03bfccec24c88ff08b15b6381.tar.xz |
rpc: add a new RPC to get current txpool backlog (sizes and fees)
Diffstat (limited to 'src/cryptonote_core/tx_pool.cpp')
-rw-r--r-- | src/cryptonote_core/tx_pool.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp index 73f519079..7b98acb63 100644 --- a/src/cryptonote_core/tx_pool.cpp +++ b/src/cryptonote_core/tx_pool.cpp @@ -553,6 +553,17 @@ namespace cryptonote }); } //------------------------------------------------------------------ + void tx_memory_pool::get_transaction_backlog(std::vector<tx_backlog_entry>& backlog) const + { + CRITICAL_REGION_LOCAL(m_transactions_lock); + CRITICAL_REGION_LOCAL1(m_blockchain); + const uint64_t now = time(NULL); + m_blockchain.for_all_txpool_txes([&backlog, now](const crypto::hash &txid, const txpool_tx_meta_t &meta, const cryptonote::blobdata *bd){ + backlog.push_back({meta.blob_size, meta.fee, meta.receive_time - now}); + return true; + }); + } + //------------------------------------------------------------------ void tx_memory_pool::get_transaction_stats(struct txpool_stats& stats) const { CRITICAL_REGION_LOCAL(m_transactions_lock); |