Skip to content

mempool: Document unsigned integer wraparounds in CTxMemPoolEntry::UpdateAncestorState(...)#14218

Closed
practicalswift wants to merge 1 commit intobitcoin:masterfrom
practicalswift:mempool-unsigned-integer-wraparound
Closed

mempool: Document unsigned integer wraparounds in CTxMemPoolEntry::UpdateAncestorState(...)#14218
practicalswift wants to merge 1 commit intobitcoin:masterfrom
practicalswift:mempool-unsigned-integer-wraparound

Conversation

@practicalswift
Copy link
Copy Markdown
Contributor

Document unsigned integer wraparounds in CTxMemPoolEntry::UpdateAncestorState(...).

@fanquake fanquake added the Docs label Sep 14, 2018
Comment thread src/txmempool.cpp
{
// An unsigned integer wraparound may take place here (modifySize is allowed to be negative).
nSizeWithAncestors += modifySize;
assert(int64_t(nSizeWithAncestors) > 0);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this can wrap around in normal operation, since it is always first increased by some modifySize and only later reduced by the same modifySize.

Also, note the assert, which would be hit if a wraparound occurs.

@practicalswift practicalswift deleted the mempool-unsigned-integer-wraparound branch April 10, 2021 19:36
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants