Skip to content

Conversation

@random-zebra
Copy link

@random-zebra random-zebra commented May 10, 2021

This PR implements CPFP transaction selection mechanism, which is the simplest "fee bumping technique" (we might want to consider implementing RBF too later on).
The algorithm in CreateNewBlock now selects transactions based on their feerate, inclusive of unconfirmed ancestor transactions. This means that a low-fee transaction can become more likely to be selected if a high-fee transaction that spends its outputs is relayed: the fee burned in the "child" transaction, actually pays for the parent tx too (hence the name).

This PR also removes completely the (already deprecated) notion of coinage-based priority and "free transactions area".

Changes backported / adapted from:

@random-zebra random-zebra added this to the 6.0.0 milestone May 10, 2021
@random-zebra random-zebra self-assigned this May 10, 2021
@random-zebra random-zebra force-pushed the 202105_nopriority branch 4 times, most recently from 178a029 to 1580748 Compare May 17, 2021 23:26
Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking really nice, light ACK 1580748eda1e649128fdc51c0e4d2025df013ec9 .
Will get deeper.

@random-zebra
Copy link
Author

Rebased, fixing conflicts.

@random-zebra
Copy link
Author

Rebased.

@random-zebra random-zebra force-pushed the 202105_nopriority branch 2 times, most recently from c41044c to ce30647 Compare June 18, 2021 11:35
@random-zebra
Copy link
Author

Rebased

Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-code ACK ce30647

@furszy
Copy link

furszy commented Jun 28, 2021

Rebase needed.

@random-zebra
Copy link
Author

Rebased again.

@furszy
Copy link

furszy commented Jul 5, 2021

will need another rebase.

@random-zebra
Copy link
Author

Rebased on master, fixing conflicts, and added last commit for #2469

@random-zebra random-zebra linked an issue Jul 6, 2021 that may be closed by this pull request
@furszy
Copy link

furszy commented Jul 7, 2021

Got broken after the rebase, will need to do some changes due the serialization framework changes.

random-zebra and others added 23 commits July 8, 2021 18:05
This was an oversight, where blocks and mempool tracking were ignored
during IBD, but transactions that arrived during IBD but were included
in blocks after IBD were not ignored.
>>> backports bitcoin/bitcoin@84f7ab0

Fee estimation can just check its own mapMemPoolTxs to determine the
same information.  Note that now fee estimation for block processing
must happen before those transactions are removed, but this shoudl be a
speedup.
All decisions about whether the transactions are valid data points are
made at the time the transaction arrives. Updating on blocks all the
time will now cause stale fee estimates to decay quickly when we restart
a node.
Make a more conservative notion of whether the node is caught up to the
rest of the network and only count transactions as fee estimation data
points if the node is caught up.
"startingpriority" and "currentpriority" are no longer returned in the
JSON information about a mempool entry.  This affects
getmempoolancestors, getmempooldescendants, getmempooolentry, and
getrawmempool.
>>> backports bitcoin/bitcoin@f9b9371

This a breaking API change to the prioritisetransaction RPC call which
previously required exactly three arguments and now requires exactly two
(hash and feeDelta).  The function prioritiseTransaction is also
updated.
>>> backports bitcoin/bitcoin@359e8a0

Remove GetPriority and ComputePriority.  Remove internal machinery for
tracking priority in CTxMemPoolEntry.
This fixes compatibility with boost 1.66
Setting minrelaytxfee to 0 will allow all transactions regardless of fee
to enter your mempool until it reaches its size limit.  However now that
mempool limiting is governed by a separate incrementalrelay fee, it is
an unnecessary restriction to prevent a minrelaytxfee of 0.
@random-zebra
Copy link
Author

Fixed

Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK f5b2e54

Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-ACK f5b2e54 after rebase and last commit.

left two comments that can be tackled in a follow up PR, merging..

Comment on lines +591 to +594
if (iter->IsShielded()) {
// Don't add SHIELD transactions if in maintenance (SPORK_20)
if (sporkManager.IsSporkActive(SPORK_20_SAPLING_MAINTENANCE)) {
break;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we are here, we missed to do the same with P2CS transactions. Shouldn't be added into a block if spork 19 is enabled.

/** If the tip is older than this (in seconds), the node is considered to be in initial block download. */
static const int64_t DEFAULT_MAX_TIP_AGE = 24 * 60 * 60;
/** Maximum age of our tip for us to be considered current for fee estimation */
static const int64_t MAX_FEE_ESTIMATION_TIP_AGE = 3 * 60 * 60;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can decrease this number to our block time so we don't track a much higher number of transactions in policy estimator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WARN] Compiling 5.2.0.1 on Gentoo 32bit

5 participants