Page MenuHomePhabricator

fix CTxMemPool::TrimToSize including too many things in pvNoSpendsRemaining
ClosedPublic

Authored by Fabien on Feb 10 2023, 11:28.

Details

Summary
Only return confirmed outpoints in `pvNoSpendsRemaining`, as is the intended behaviour.

With the current code, removed chains of tx will have all internally-spent outpoints included in this vector, which is not the intended result. It seems to have been incorrectly coded from the very start (https://github.com/bitcoin/bitcoin/pull/6872) but the bug is benign as this result is only used to uncache coins.

As a bonus, no copying of CTransaction is needed.

An existing test case is modified to test this behaviour (the modified test will fail
under prior behaviour).

Port of bchn#761.

Test Plan
ninja all check-all