Page MenuHomePhabricator

test: tx orphan handling
ClosedPublic

Authored by Fabien on Jul 19 2024, 09:32.

Details

Reviewers
PiRK
Group Reviewers
Restricted Project
Commits
rABC969e03c50dad: test: tx orphan handling
Summary
I was doing some mutation testing (through reckless refactoring) locally and found some specific behaviors in orphan handling that weren't picked up by tests. Adding some of these test cases now can maybe help with reviewing refactors like #28031.
 - Parent requests aren't sent immediately. A delay is added and the requests are filtered by AlreadyHaveTx before they are sent, which means you can't use fake orphans to probe precise arrival timing of a tx.
 - Parent requests include all that are not AlreadyHaveTx. This means old confirmed parents may be requested.
 - The node does not give up on orphans if the peer responds to a parent request with notfound. This means that if a parent is an old confirmed transaction (in which notfound is expected), the orphan should still be resolved.
 - Rejected parents can cause an orphan to be dropped, but it depends on the reason and only based on txid.
 - Rejected parents can cause an orphan to be rejected too, by both wtxid and txid.
 - Requests for orphan parents should be de-duplicated with "regular" txrequest. If a missing parent has the same hash as an in-flight request, it shouldn't be requested.
 - Multiple orphans with overlapping parents should not cause duplicated parent requests.

Backport of core#28199.

The test_orphan_inherit_rejection case makes no sense without segwit so it has been removed, and well as some changes related to the absence of segwit and/or mempool ancestors accounting.

Depends on D16505.

Test Plan
./test/functional/test_runner.py p2p_orphan_handling

Diff Detail

Event Timeline

Fabien requested review of this revision.Jul 19 2024, 09:32
Fabien planned changes to this revision.Jul 19 2024, 11:18
Fabien added inline comments.
test/functional/test_framework/p2p.py
95

Note: this is from another PR, needs a rebase

PiRK added a subscriber: PiRK.
PiRK added inline comments.
test/functional/p2p_orphan_handling.py
124 ↗(On Diff #48738)
This revision is now accepted and ready to land.Jul 19 2024, 12:57
This revision was automatically updated to reflect the committed changes.