-
Notifications
You must be signed in to change notification settings - Fork 37.7k
RBF move 3/3: move followups + improve RBF documentation #22855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
df285a0
to
cecb025
Compare
cecb025
to
7c48d19
Compare
Document a few non-obvious things and delete no-longer-relevant comments (e.g. about taking a lock that we're already holding). No change in behavior.
7c48d19
to
3cf46f6
Compare
Concept ACK. While you're tidying up might as well add all the missing |
@@ -17,7 +17,7 @@ static const uint32_t MAX_BIP125_RBF_SEQUENCE = 0xfffffffd; | |||
* | |||
* SEQUENCE_FINAL-1 is picked to still allow use of nLockTime by non-replaceable transactions. All | |||
* inputs rather than just one is for the sake of multi-party protocols, where we don't want a single | |||
* party to be able to disable replacement. */ | |||
bool SignalsOptInRBF(const CTransaction &tx); | |||
* party to be able to disable replacement by opting out in their own input. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
micro-nit "by opting out of their single-owned input". If the input spent is 2-of-2 like LN's commitment you should check that counterparty's signature is covering a RBF-signaling nSequence
field.
// replacement doesn't pay more fees than its direct conflicts, then we can be sure it's not | ||
// more economically rational to mine. Before we go digging through the mempool for all | ||
// transactions that would need to be removed (direct conflicts and all descendants), check | ||
// that the replacement transaction pays more than its direct conflicts. | ||
if (const auto err_string{PaysMoreThanConflicts(setIterConflicting, newFeeRate, hash)}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would interesting to add a comment noting that this higher-feerate than any directly replaced transactions it's not part of the BIP.
Also I think this check might bounce-off higher-fee transactions than the replaced one if the conflict transaction has a higher feerate. Let's say a 2_000 vb/10_000 sats replacement vs a 100 vb/8_000 sats conflicts. Without entering in a discussion on the miner block strategy, this is at lest consistent with BlockAssembler::addPackageTxs
which is selecting packages on feerate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would interesting to add a comment noting that this higher-feerate than any directly replaced transactions it's not part of the BIP.
I thought that's what I was doing by adding this comment 😅 but if you have a more specific wording suggestion I'd be happy to add!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 3cf46f6
Concept ACK |
Thanks for the reviews, addressed comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 0ef08f8
If you retouch this branch, perhaps you could add the justification/motivation to the commit log for commit [policy/refactor] pass in relay fee instead of using global. If the change was suggested in a previous review comment, you could also link to it from the commit log.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 0ef08f8
// replacement doesn't pay more fees than its direct conflicts, then we can be sure it's not | ||
// more economically rational to mine. Before we go digging through the mempool for all | ||
// transactions that would need to be removed (direct conflicts and all descendants), check | ||
// that the replacement transaction pays more than its direct conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late review note, but I think this comment is confusing: in PaysMoreThanConflicts()
we're checking that the feerate of the new transaction is higher than its direct conflicts, not that the total fees paid are higher (eg if the new transaction is smaller, the feerate could be higher but the total fees paid can be lower).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah thank you, I should have said feerate.
I also misinterpreted the purpose of the code - I was thinking of mining scores=ancestor feerate so I assumed it was an incomplete-but-early-exit check. Based on the context you provided (#23121 (review)), this was checking that the replacement is a better mining candidate based on the block template code at the time. I'll open a PR to update this comment to reflect that.
77202f0 [doc] package deduplication (glozow) d35a3cb [doc] clarify inaccurate comment about replacements paying higher feerate (glozow) 5ae187f [validation] look up transaction by txid (glozow) Pull request description: - Use txid, not wtxid, for `mempool.GetIter()`: bitcoin/bitcoin#22674 (comment) - Fix a historically inaccurate comment about RBF during the refactors: bitcoin/bitcoin#22855 (comment) - Add a section about package deduplication to policy/packages.md: bitcoin/bitcoin#24152 (comment) and bitcoin/bitcoin#24152 (comment) (I'm intending for this to be in v23 since it's fixups for things that are already merged, which is why I split it from #24152) ACKs for top commit: t-bast: LGTM, ACK bitcoin/bitcoin@77202f0 darosior: ACK 77202f0 LarryRuane: ACK 77202f0 Tree-SHA512: a428e791dfa59c359d3ccc67e8d3a4c1239815d2f6b29898e129700079271c00b3a45f091f70b65a6e54aa00a3d5b678b6da29d2a76b6cd6f946eaa7082ea696
77202f0 [doc] package deduplication (glozow) d35a3cb [doc] clarify inaccurate comment about replacements paying higher feerate (glozow) 5ae187f [validation] look up transaction by txid (glozow) Pull request description: - Use txid, not wtxid, for `mempool.GetIter()`: bitcoin#22674 (comment) - Fix a historically inaccurate comment about RBF during the refactors: bitcoin#22855 (comment) - Add a section about package deduplication to policy/packages.md: bitcoin#24152 (comment) and bitcoin#24152 (comment) (I'm intending for this to be in v23 since it's fixups for things that are already merged, which is why I split it from bitcoin#24152) ACKs for top commit: t-bast: LGTM, ACK bitcoin@77202f0 darosior: ACK 77202f0 LarryRuane: ACK 77202f0 Tree-SHA512: a428e791dfa59c359d3ccc67e8d3a4c1239815d2f6b29898e129700079271c00b3a45f091f70b65a6e54aa00a3d5b678b6da29d2a76b6cd6f946eaa7082ea696
Followups to #22675 and documentation-only changes intended to clarify the code/logic concerning mempool Replace-by-Fee.