aboutsummaryrefslogtreecommitdiff
path: root/src/memusage.h
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2015-07-15 14:47:45 -0400
committerSuhas Daftuar <sdaftuar@chaincode.com>2015-09-19 13:25:48 -0400
commit5add7a74a672cb12b0a2a630d318d9bc64dd0f77 (patch)
treee8b86acba14f47100af0bbadeb748f6f6a002d58 /src/memusage.h
parent34628a18070064e75b35f28fd6a43d5c23832eb8 (diff)
downloadbitcoin-5add7a74a672cb12b0a2a630d318d9bc64dd0f77.tar.xz
Track transaction packages in CTxMemPoolEntry
Associate with each CTxMemPoolEntry all the size/fees of descendant mempool transactions. Sort mempool by max(feerate of entry, feerate of descendants). Update statistics on-the-fly as transactions enter or leave the mempool. Also add ancestor and descendant limiting, so that transactions can be rejected if the number or size of unconfirmed ancestors exceeds a target, or if adding a transaction would cause some other mempool entry to have too many (or too large) a set of unconfirmed in- mempool descendants.
Diffstat (limited to 'src/memusage.h')
-rw-r--r--src/memusage.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/memusage.h b/src/memusage.h
index be3964df1b..b475c3313b 100644
--- a/src/memusage.h
+++ b/src/memusage.h
@@ -74,18 +74,30 @@ static inline size_t DynamicUsage(const std::vector<X>& v)
return MallocUsage(v.capacity() * sizeof(X));
}
-template<typename X>
-static inline size_t DynamicUsage(const std::set<X>& s)
+template<typename X, typename Y>
+static inline size_t DynamicUsage(const std::set<X, Y>& s)
{
return MallocUsage(sizeof(stl_tree_node<X>)) * s.size();
}
template<typename X, typename Y>
-static inline size_t DynamicUsage(const std::map<X, Y>& m)
+static inline size_t IncrementalDynamicUsage(const std::set<X, Y>& s)
+{
+ return MallocUsage(sizeof(stl_tree_node<X>));
+}
+
+template<typename X, typename Y, typename Z>
+static inline size_t DynamicUsage(const std::map<X, Y, Z>& m)
{
return MallocUsage(sizeof(stl_tree_node<std::pair<const X, Y> >)) * m.size();
}
+template<typename X, typename Y, typename Z>
+static inline size_t IncrementalDynamicUsage(const std::map<X, Y, Z>& m)
+{
+ return MallocUsage(sizeof(stl_tree_node<std::pair<const X, Y> >));
+}
+
// Boost data structures
template<typename X>