mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
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.
This commit is contained in:
parent
681ecac5c2
commit
fa76f0d0ef
3 changed files with 9 additions and 10 deletions
|
|
@ -370,8 +370,8 @@ void CTxMemPoolEntry::UpdateDescendantState(int32_t modifySize, CAmount modifyFe
|
|||
nSizeWithDescendants += modifySize;
|
||||
assert(nSizeWithDescendants > 0);
|
||||
nModFeesWithDescendants = SaturatingAdd(nModFeesWithDescendants, modifyFee);
|
||||
nCountWithDescendants += uint64_t(modifyCount);
|
||||
assert(int64_t(nCountWithDescendants) > 0);
|
||||
m_count_with_descendants += modifyCount;
|
||||
assert(m_count_with_descendants > 0);
|
||||
}
|
||||
|
||||
void CTxMemPoolEntry::UpdateAncestorState(int32_t modifySize, CAmount modifyFee, int64_t modifyCount, int64_t modifySigOps)
|
||||
|
|
@ -379,8 +379,8 @@ void CTxMemPoolEntry::UpdateAncestorState(int32_t modifySize, CAmount modifyFee,
|
|||
nSizeWithAncestors += modifySize;
|
||||
assert(nSizeWithAncestors > 0);
|
||||
nModFeesWithAncestors = SaturatingAdd(nModFeesWithAncestors, modifyFee);
|
||||
nCountWithAncestors += uint64_t(modifyCount);
|
||||
assert(int64_t(nCountWithAncestors) > 0);
|
||||
m_count_with_ancestors += modifyCount;
|
||||
assert(m_count_with_ancestors > 0);
|
||||
nSigOpCostWithAncestors += modifySigOps;
|
||||
assert(int(nSigOpCostWithAncestors) >= 0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue