mirror of
https://github.com/monero-project/monero.git
synced 2025-08-15 14:00:23 -04:00
rpc: add a new RPC to get current txpool backlog (sizes and fees)
This commit is contained in:
parent
335681896a
commit
55bec1f03d
7 changed files with 80 additions and 0 deletions
|
@ -246,6 +246,12 @@ namespace cryptonote
|
|||
return m_blockchain_storage.get_transactions_blobs(txs_ids, txs, missed_txs);
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
bool core::get_txpool_backlog(std::vector<tx_backlog_entry>& backlog) const
|
||||
{
|
||||
m_mempool.get_transaction_backlog(backlog);
|
||||
return true;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
bool core::get_transactions(const std::vector<crypto::hash>& txs_ids, std::list<transaction>& txs, std::list<crypto::hash>& missed_txs) const
|
||||
{
|
||||
return m_blockchain_storage.get_transactions(txs_ids, txs, missed_txs);
|
||||
|
|
|
@ -427,6 +427,13 @@ namespace cryptonote
|
|||
*/
|
||||
bool get_pool_transactions(std::list<transaction>& txs) const;
|
||||
|
||||
/**
|
||||
* @copydoc tx_memory_pool::get_txpool_backlog
|
||||
*
|
||||
* @note see tx_memory_pool::get_txpool_backlog
|
||||
*/
|
||||
bool get_txpool_backlog(std::vector<tx_backlog_entry>& backlog) const;
|
||||
|
||||
/**
|
||||
* @copydoc tx_memory_pool::get_transactions
|
||||
*
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -242,6 +242,13 @@ namespace cryptonote
|
|||
*/
|
||||
void get_transaction_hashes(std::vector<crypto::hash>& txs) const;
|
||||
|
||||
/**
|
||||
* @brief get (size, fee, receive time) for all transaction in the pool
|
||||
*
|
||||
* @param txs return-by-reference that data
|
||||
*/
|
||||
void get_transaction_backlog(std::vector<tx_backlog_entry>& backlog) const;
|
||||
|
||||
/**
|
||||
* @brief get a summary statistics of all transaction hashes in the pool
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue