aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.h
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-01-15 16:39:37 +0100
committerMarcoFalke <falke.marco@gmail.com>2021-01-28 10:43:22 +0100
commitfa362064e383163a2585ffbc71ac1ea3bcc92663 (patch)
tree8b8494e25d23c9de4ddae36c848a05ec28deaa54 /src/txmempool.h
parent4bd586607d6305b828f0f554394d1c25b6dbcd14 (diff)
downloadbitcoin-fa362064e383163a2585ffbc71ac1ea3bcc92663.tar.xz
rpc: Return total fee in mempool
Also, add missing lock annotations
Diffstat (limited to 'src/txmempool.h')
-rw-r--r--src/txmempool.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/txmempool.h b/src/txmempool.h
index 0a9cd81ff5..c0df33fe13 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -19,8 +19,8 @@
#include <optional.h>
#include <policy/feerate.h>
#include <primitives/transaction.h>
-#include <sync.h>
#include <random.h>
+#include <sync.h>
#include <util/hasher.h>
#include <boost/multi_index_container.hpp>
@@ -478,8 +478,9 @@ private:
std::atomic<unsigned int> nTransactionsUpdated{0}; //!< Used by getblocktemplate to trigger CreateNewBlock() invocation
CBlockPolicyEstimator* minerPolicyEstimator;
- uint64_t totalTxSize; //!< sum of all mempool tx's virtual sizes. Differs from serialized tx size since witness data is discounted. Defined in BIP 141.
- uint64_t cachedInnerUsage; //!< sum of dynamic memory usage of all the map elements (NOT the maps themselves)
+ uint64_t totalTxSize GUARDED_BY(cs); //!< sum of all mempool tx's virtual sizes. Differs from serialized tx size since witness data is discounted. Defined in BIP 141.
+ CAmount m_total_fee GUARDED_BY(cs); //!< sum of all mempool tx's fees (NOT modified fee)
+ uint64_t cachedInnerUsage GUARDED_BY(cs); //!< sum of dynamic memory usage of all the map elements (NOT the maps themselves)
mutable int64_t lastRollingFeeUpdate;
mutable bool blockSinceLastRollingFeeBump;
@@ -724,6 +725,12 @@ public:
return totalTxSize;
}
+ CAmount GetTotalFee() const EXCLUSIVE_LOCKS_REQUIRED(cs)
+ {
+ AssertLockHeld(cs);
+ return m_total_fee;
+ }
+
bool exists(const GenTxid& gtxid) const
{
LOCK(cs);