Repository navigation
Conversation
…andidate When a peer announces the wtxid of a transaction in the orphanage, AddTxAnnouncement computes the orphan's missing parents before MaybeAddOrphanResolutionCandidate decides whether the peer can become a resolution candidate. For an orphan with many inputs this means thousands of lookups per announcement, and the result is discarded when the peer is already an announcer or has no room left in its announcement budget. Do both checks first. The budget check uses the number of inputs as an upper bound for the number of missing parents, so a peer close to MAX_PEER_TX_ANNOUNCEMENTS may no longer be added as a candidate for an orphan whose inputs share parents or whose parents are partly known. Signed-off-by: Jan Kahmen <[email protected]>
Contributor
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process. ConflictsNo conflicts as of last run. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

For a wtxid announcement of a transaction that is in the orphanage,
AddTxAnnouncementcomputes the missing parents of the orphan (GetUniqueParents, thenAlreadyHaveTxper parent) and then callsMaybeAddOrphanResolutionCandidate. That function returns without using the parents if the peer is already an announcer of the orphan. If the peer has no relay permission andm_txrequest.Count(peer) + unique_parents.size() > MAX_PEER_TX_ANNOUNCEMENTS, it returns after using only their count. In both cases the peer is not added as a candidate, and the same lookups run again for everyinvmessage that lists the wtxid. #35878 deduplicates within one message only.This PR does both checks before the parent lookups. The second check uses
vin.size()in place of the number of missing parents.Behavior change:
vin.size()is an upper bound for the number of missing parents. A peer without relay permission is no longer added as a candidate whenCount(peer) + vin.size()exceedsMAX_PEER_TX_ANNOUNCEMENTSbutCount(peer)plus the number of missing parents does not. That needs inputs that share a parent, or parents that are already known.Measurement: regtest, one node, RelWithDebInfo, base a527a00. The orphanage holds 12 orphans with 2430 inputs each. One peer, which delivered one of the 12 orphans and has sent at least 3600 announcements of unknown wtxids before, sends 300
invmessages that each list the 12 wtxids. Time perinvmessage:Tests: no new test. Passing locally: unit suites
txdownload_testsandorphanage_tests; functionalp2p_orphan_handling.py,p2p_tx_download.py,p2p_opportunistic_1p1c.py,p2p_1p1c_network.py,p2p_invalid_tx.py,p2p_permissions.py,p2p_leak_tx.py,mempool_packages.py. Not run: the rest of both suites, fuzz targets, lint.Contributed by turingpoint.