HomePhabricator

fix CTxMemPool::TrimToSize including too many things in pvNoSpendsRemaining

Description

fix CTxMemPool::TrimToSize including too many things in pvNoSpendsRemaining

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

Reviewers: #bitcoin_abc, sdulfari

Reviewed By: #bitcoin_abc, sdulfari

Differential Revision: https://reviews.bitcoinabc.org/D13120

Details

Provenance
Mark Lundeberg <5505128-markblundeberg@users.noreply.gitlab.com>Authored on Sep 4 2020, 23:53
FabienCommitted on Feb 13 2023, 19:51
FabienPushed on Feb 13 2023, 19:51
Reviewer
Restricted Project
Differential Revision
D13120: fix CTxMemPool::TrimToSize including too many things in pvNoSpendsRemaining
Parents
rABC8b0ce495ddf9: Rename mempool method queryHashes to getAllTxIds
Branches
Unknown
Tags
Unknown