HomePhabricator

Make check to distinguish between orphan txs and old txs more efficient.

Description

Make check to distinguish between orphan txs and old txs more efficient.

Summary:
Checking for the existence in the CCoinsViewCache of the outputs of a new tx
will result in a disk hit for every output since they will not be found. On the
other hand if those outputs exist already, then the inputs must also have been
missing, so we can move this check inside the input existence check so in the
common case of a new tx it doesn't need to run.

The purpose of the check is to avoid spamming the orphanMap with slightly old
txs which we have already seen in a block, but it is already only optimistic
(depending on the outputs not being spent), so make it even more efficient by
only checking the cache and not the entire pcoinsTip.

Backport core PR10557

Depends on D1733

Test Plan:

make check

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Subscribers: teamcity

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

Details

Provenance
Alex Morcos <morcos@chaincode.com>Authored on Jun 8 2017, 14:41
deadalnixCommitted on Sep 6 2018, 22:09
deadalnixPushed on Sep 6 2018, 22:09
Reviewer
Restricted Project
Differential Revision
D1734: Make check to distinguish between orphan txs and old txs more efficient.
Parents
rABC6271317143bb: Hold mempool.cs for the duration of ATMP.
Branches
Unknown
Tags
Unknown