Document unsigned integer wraparounds in CTxMemPoolEntry::UpdateAncestorState(...).
mempool: Document unsigned integer wraparounds in CTxMemPoolEntry::UpdateAncestorState(...) #14218
pull practicalswift wants to merge 1 commits into bitcoin:master from practicalswift:mempool-unsigned-integer-wraparound changing 1 files +5 −0-
practicalswift commented at 8:11 AM on September 14, 2018: contributor
-
mempool: Document unsigned integer wraparounds in CTxMemPoolEntry::UpdateAncestorState(...) aaefdfc12d
- fanquake added the label Docs on Sep 14, 2018
-
in src/txmempool.cpp:319 in aaefdfc12d
313 | @@ -314,11 +314,16 @@ void CTxMemPoolEntry::UpdateDescendantState(int64_t modifySize, CAmount modifyFe 314 | 315 | void CTxMemPoolEntry::UpdateAncestorState(int64_t modifySize, CAmount modifyFee, int64_t modifyCount, int64_t modifySigOps) 316 | { 317 | + // An unsigned integer wraparound may take place here (modifySize is allowed to be negative). 318 | nSizeWithAncestors += modifySize; 319 | assert(int64_t(nSizeWithAncestors) > 0);
MarcoFalke commented at 12:56 PM on September 14, 2018:I don't think this can wrap around in normal operation, since it is always first increased by some
modifySizeand only later reduced by the samemodifySize.Also, note the assert, which would be hit if a wraparound occurs.
practicalswift closed this on Sep 14, 2018practicalswift deleted the branch on Apr 10, 2021DrahtBot locked this on Aug 16, 2022ContributorsLabels
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-16 15:15 UTC
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-16 15:15 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me