Skip to content

p2p: make orphan processing interruptible (backport) - #64

Merged
NiftyRaven merged 4 commits into
x-coinfrom
p2p/orphan-processing
Sep 27, 2026
Merged

NiftyRaven merged 4 commits into
x-coinfrom
p2p/orphan-processing

Conversation

@NiftyRaven

@NiftyRaven NiftyRaven commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

Backport of upstream Bitcoin Core PR #15644 ("Make orphan processing interruptible", commit 866c8058a706931f025335b3e794ed2f4d287918) for network robustness.

  • Each peer keeps an orphan_work_set.
  • ProcessOrphanTx validates one orphan per call.
  • ProcessMessages resumes that work on the peer's next turn.
  • Consensus, validation, chainparams, and asset code are unchanged.

Wallet version is 1.0.20 (same places the 1.0.19 release bumped). Release notes: docs/RELEASE-1.0.20.md. Package workflows: .github/workflows/package-xcoin-1.0.20.yml and the Light equivalent.

Sign in with X / Re-link can be tried again after 5 minutes (kOAuthCooldownMs, previously one hour). The loopback callback wait stays 15 seconds. A live GUI session still has exp 0 (no wall-clock end). Regtest mock sessions still write a 365-day exp, and that value is not a kick.

A regression functional test (test/functional/p2p_orphan_processing.py) sends many orphans that each spend several outputs of a not-yet-seen parent, then the parent. It checks that every orphan is accepted and that another peer still completes ping/pong while that work is in progress. .github/workflows/orphan-processing.yml builds and runs the related tests on pushes to this branch.

Deviations from the attached patch

Behavior matches the patch and upstream 866c805. This tree has no separate orphan lock, so ProcessOrphanTx stays under cs_main and calls mempool.check(pcoinsTip). The patch's validation-state comment was reworded. net.h includes <set> and a one-line note on orphan_work_set. The release test's version integer is 1002000 (the 1.0.19 bump still expected 1001800).

The functional harness uses this chain's network magic and protocol version 70028, ignores unknown peer commands, and passes a regtest Sign-in mock so generate() can write an active-set commitment.

Test plan

  • Build (./configure --without-gui --disable-bench --with-incompatible-bdb && make -j3) — compiled. xcoind reports v1.0.20.0-36f8677. Warnings only. Later commits do not change the node sources that binary was built from, except the Qt Sign in cooldown (not rebuilt here).
  • DoS_tests/DoS_maporphans_test — pass
  • xrelease_tests — pass (7 cases)
  • make check — fail, pre-existing. Exit 2: test/util/raven-util-test.py is missing, and test/test_raven aborts (368 cases, 2596 failures). The branch workflow does not gate on that suite.
  • mempool_limit.py — pass (5 s)
  • mempool_persist.py — pass (29 s)
  • p2p_mempool.py — pass (1 s)
  • p2p_leak_tx.py — pass (1 s)
  • p2p_disconnect_ban.py — pass (2 s)
  • p2p_orphan_processing.py — pass. Peer B ping/pong returned in 0.050 s; 32 accepted-orphan log lines; 1 ping log line between the first and last accept.
  • mempool_reorg.py — fail. create_tx cannot sign height-102 coinbase vout 0. That output pays an address the mining wallet does not own after payout scripts are applied.
  • feature_assets_mempool.py — fail. issue() requires an identity root.

X16R TODO skips already listed in test_runner.py (not run): feature_cltv, feature_dersig, feature_nulldummy, feature_segwit, mining_basic, p2p_compactblocks, p2p_fingerprint, p2p_segwit, p2p_sendheaders.

Open in Web Open in Cursor 

cursoragent and others added 4 commits September 27, 2026 02:59
Backport Bitcoin Core PR #15644 (866c805) so each peer keeps an
orphan_work_set and one orphan is validated per turn. ProcessMessages
resumes that work on the peer's next turn.

Bump the wallet to 1.0.20. Consensus unchanged.

Co-authored-by: NiFTy_RaVeN <nerontus@gmail.com>
The functional harness still used the previous network magic and a
protocol version below the peer minimum, so p2p tests could not
complete a handshake. Unknown commands are ignored so extra peer
messages do not drop the connection. The orphan regression test mines
its own regtest chain with a Sign-in mock.

Co-authored-by: NiFTy_RaVeN <nerontus@gmail.com>
Regtest coinbases require an active-set commitment. The harness now
passes a per-node Sign-in mock for the shared cache and for each test
node. The branch workflow runs the orphan-map and release unit tests
plus the functional tests that complete on this chain.

Co-authored-by: NiFTy_RaVeN <nerontus@gmail.com>
The desktop Sign in / Re-link cooldown was one hour. It is now five
minutes. The session file lifetime is unchanged. The branch test
workflow notes why the full unit suite is not the gate.

Co-authored-by: NiFTy_RaVeN <nerontus@gmail.com>
@NiftyRaven
NiftyRaven marked this pull request as ready for review September 27, 2026 03:41
@NiftyRaven
NiftyRaven merged commit b9d8161 into x-coin Sep 27, 2026
1 check passed
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