mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 16:29:39 +00:00
p2p: clean up a 1p1c package child that is already in the mempool #36578
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36578
Loading…
Reference in a new issue
No description provided.
Delete branch "2026-10-1p1c-orphan-in-mempool"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
An orphan that enters the mempool other than through peer relay (e.g. by
RPC) stays in the orphanage, so
Find1P1CPackagecan pick it as the childof a reconsiderable parent, and package evaluation then reports it as
MEMPOOL_ENTRY, which hitsAssume(false). HaveFind1P1CPackageerase suchchildren from the orphanage and skip them.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Conflicts
Reviewers, 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.
@ismaelsadeeq
No verified findings are available from this review.
Review coverage was incomplete.
Reviewed:
9e8e61ae8e39· Full review report · Previous reportspermalink
Tested ACK
b0dda32affon Windows.Not sure, the
Assume(false)removed is a no-op in release, and the replacement cleans the orphan only reactively when it's later re-selected as a 1p1c child. If that never happens, the orphan dangles until it expires. I'd rather we clean the orphanage proactively on mempool entry, viaTransactionAddedToMempool? so an orphan that enters by any path is removed regardless. This is redundant ofc with the existing p2p cleanup for relayed txs, but we need both: the notification is async and can be processed before the orphan is inserted (it's EraseTx then no-ops), so the synchronous p2p path still does useful work.This would not have been an open issue otherwise :)
I think if we're going to do that, we should simply have it call
EraseTxto avoid additionalAddChildrenToWorkSetinvocations.Another alternative to the synchronous piece in this PR would to have
Find1P1CPackagedetect children in the mempool as well as orphanage and clean it up there.Seems better to me; is there something I am missing about why you take this approach in this PR?
@ismaelsadeeq swtiched to the Find1P1CPackage strategy for now; can still be convinced the extra machinery to async sweep them and taking lock is worth it, but keeping strategy as is for now
tACK
a93bdc8320The
Assume(false)is also reached throughsendrawtransaction, not only throughsubmitpackageas in the new test. I checked on master in a Debug build. The parent pays the minimum relay fee for its own size. A peer sends a copy with a padded witness, which has the same txid but falls below the minimum relay feerate, so it is rejected as reconsiderable. The same peer's child is then kept as an orphan. Twosendrawtransactioncalls put the real parent and the child in the mempool. When the peer sends the padded parent again, the node aborts at net_processing.cpp:3477. With this PR the child leaves the orphanage at that point and stays in the mempool.In the same scenario the child stays in the orphanage after both
sendrawtransactioncalls, with or without this PR, until the padded parent pairs with it. That is the reactive cleanup ismaelsadeeq pointed out, and I agree with keeping a mempool hook out of this PR.I tested the head merged into master
a773e1e33b, in a Debug build, with p2p_orphan_handling (the new case aborts the node on master), p2p_opportunistic_1p1c and the txdownload and txpackage unit tests. I ran them again with #36594 and #36437 merged on top. I can share the functional test as a gist.Code review ACK
a93bdc8320Is there a reason to check by wtxid and not txid? If there's an orphan with the same txid but different witness, we still evaluate the package here even though it can't get into the mempool.
I know it's still just a PR but In combination with
152f7b74cein https://github.com/bitcoin/bitcoin/pull/36506, I think this means the orphan would end up staying in the orphanage.yes you're correct, and this would also cover the case where a different wtxid enters through p2p, which the current fix misses.
ACK
9e8e61ae8ereACK
9e8e61ae8e