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
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