Skip to content

p2p: make orphan processing interruptible (backport of bitcoin#15644) - #1325

Open
NiftyRaven wants to merge 1 commit into
RavenProject:masterfrom
NiftyRaven:p2p/interruptible-orphan-processing
Open

NiftyRaven wants to merge 1 commit into
RavenProject:masterfrom
NiftyRaven:p2p/interruptible-orphan-processing

Conversation

@NiftyRaven

Copy link
Copy Markdown

Backport of Bitcoin Core #15644 ("Make orphan processing interruptible", commit 866c8058a706931f025335b3e794ed2f4d287918).

Summary

  • Each peer keeps an orphan_work_set of orphan transactions to reconsider.
  • ProcessOrphanTx handles one orphan per call instead of working through all of them at once.
  • ProcessMessages resumes that work on the peer's next turn, so other peers are serviced in between.
  • Consensus, validation and asset code are unchanged.

Tests

  • Adds test/functional/p2p_orphan_processing.py (registered in test_runner.py): sends many orphans that each spend several outputs of a not-yet-seen parent, then the parent, and checks that every orphan is accepted and that another peer still gets ping/pong answered while that work is in progress.
  • The same change has been running in a closely related Ravencoin-based codebase with DoS_tests and the new functional test passing. A full build and test run on this branch is in progress, and results will be posted here.

Thanks to vvoidwalker for raising this on Discord.

Backport of Bitcoin Core commit 866c805
(bitcoin/bitcoin#15644).

Orphan reconsideration is stored per peer and one orphan is handled per
message-handler turn, so other peers can be serviced in between.

Co-authored-by: NiFTy_RaVeN <nerontus@gmail.com>
@NiftyRaven

Copy link
Copy Markdown
Author

Build and test run on this branch completed, all passing:

  • DoS_tests (5 cases)
  • p2p_orphan_processing.py (new)
  • mempool_limit.py, mempool_persist.py, mempool_reorg.py
  • p2p_mempool.py, p2p_disconnect_ban.py

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants