aboutsummaryrefslogtreecommitdiff
path: root/src/kernel
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-06-14 18:22:55 +0200
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-06-14 23:15:20 +0200
commitfa76f0d0efccd1ea272a46060022eea3e998268e (patch)
tree236e57913af648f41eabc13455307d39ad4b60df /src/kernel
parent681ecac5c2d462920cd32636eec15599a9bcf424 (diff)
downloadbitcoin-fa76f0d0efccd1ea272a46060022eea3e998268e.tar.xz
refactor: Make m_count_with_* in CTxMemPoolEntry int64_t, drop UBSAN supp
This is a refactor as long as no signed integer overflow appears. In normal operation and absent bugs, signed integer overflow should never happen in the touched code paths. The main benefit of this refactor is to drop the file-wide ubsan suppression unsigned-integer-overflow:txmempool.cpp. For now, this only changes the internal private representation and the publicly returned type remains uint64_t.
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/mempool_entry.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/kernel/mempool_entry.h b/src/kernel/mempool_entry.h
index 969ddcd1ce..886e1e1b3a 100644
--- a/src/kernel/mempool_entry.h
+++ b/src/kernel/mempool_entry.h
@@ -57,7 +57,7 @@ struct CompareIteratorByHash {
* ("descendant" transactions).
*
* When a new entry is added to the mempool, we update the descendant state
- * (nCountWithDescendants, nSizeWithDescendants, and nModFeesWithDescendants) for
+ * (m_count_with_descendants, nSizeWithDescendants, and nModFeesWithDescendants) for
* all ancestors of the newly added transaction.
*
*/
@@ -87,13 +87,13 @@ private:
// Information about descendants of this transaction that are in the
// mempool; if we remove this transaction we must remove all of these
// descendants as well.
- uint64_t nCountWithDescendants{1}; //!< number of descendant transactions
+ int64_t m_count_with_descendants{1}; //!< number of descendant transactions
// Using int64_t instead of int32_t to avoid signed integer overflow issues.
int64_t nSizeWithDescendants; //!< ... and size
CAmount nModFeesWithDescendants; //!< ... and total fees (all including us)
// Analogous statistics for ancestor transactions
- uint64_t nCountWithAncestors{1};
+ int64_t m_count_with_ancestors{1};
// Using int64_t instead of int32_t to avoid signed integer overflow issues.
int64_t nSizeWithAncestors;
CAmount nModFeesWithAncestors;
@@ -153,13 +153,13 @@ public:
lockPoints = lp;
}
- uint64_t GetCountWithDescendants() const { return nCountWithDescendants; }
+ uint64_t GetCountWithDescendants() const { return m_count_with_descendants; }
int64_t GetSizeWithDescendants() const { return nSizeWithDescendants; }
CAmount GetModFeesWithDescendants() const { return nModFeesWithDescendants; }
bool GetSpendsCoinbase() const { return spendsCoinbase; }
- uint64_t GetCountWithAncestors() const { return nCountWithAncestors; }
+ uint64_t GetCountWithAncestors() const { return m_count_with_ancestors; }
int64_t GetSizeWithAncestors() const { return nSizeWithAncestors; }
CAmount GetModFeesWithAncestors() const { return nModFeesWithAncestors; }
int64_t GetSigOpCostWithAncestors() const { return nSigOpCostWithAncestors; }