Page MenuHomePhabricator

[mining] Track maximum feerate of parent packages
Needs RevisionPublic

Authored by schancel on May 31 2019, 06:06.

Details

Reviewers
deadalnix
jasonbcox
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Summary

Currently, our CBlockTemplateEntries track their transction "height"
in the packageOrder field. This allows them to be efficiently placed into a block
template via simple topological sort (which can be sorted within a height by fee).
However, we currently still place them into the block template by their packageFees as
determined by the mempool's calculations. This is because switching to this topological+fee
sort would break much of the existing test expectations, and all functionality of "child pays
for parent.".

Therefore, this commit continues the earlier topological ordering work, but resets the
order of a transactions package to 0 when it is determined that the package, for which a given
txn is the terminal txn for, would have a higher feerate than any of the parent packages.

Then, when the transaction is of order 0, we use its package fees, rather than its individual
fees to calculate a feerate. We are able to do this, because we know this feerate is maximal
for the package. Meaning that including the transaction, and all of its parents, is going to be
more cost effective for a miner, than including any valid subset of parents (that would not have
already been included on their own anyways).

Depends on D3163

Test Plan
make check

Diff Detail

Repository
rABC Bitcoin ABC
Branch
chains-for-real4-6 (branched from master)
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 6110
Build 10268: Bitcoin ABC Buildbot (legacy)
Build 10267: arc lint + arc unit