aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/tx_pool.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-08-26 16:23:31 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-08-26 16:23:31 +0100
commit55bec1f03db039e03bfccec24c88ff08b15b6381 (patch)
tree308a12af39b884c63eeec58aa26e076f2e622de3 /src/cryptonote_core/tx_pool.cpp
parentMerge pull request #2311 (diff)
downloadmonero-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.cpp11
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);