Skip to content

bch(M5): handshake-gated auto-getheaders kick — embedded header-sync self-start - #240

Merged
frstrtr merged 1 commit into
masterfrom
bch/m5-auto-getheaders-kick
Jun 19, 2026
Merged

bch(M5): handshake-gated auto-getheaders kick — embedded header-sync self-start#240
frstrtr merged 1 commit into
masterfrom
bch/m5-auto-getheaders-kick

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Summary

The embedded BCH P2P node now self-starts header sync at handshake. The verack handler self-issues the initial getheaders from the HeaderChain back-off locator when armed, so production run() drives IBD without an external getheaders poll.

  • p2p_node.hpp: m_auto_getheaders_on_handshake + enable_auto_getheaders(); verack tail self-issues getheaders (mirrors the ContinueSync locator policy for the INITIAL batch).
  • embedded_daemon.hpp: maybe_start_p2p() arms it (gated on configured peer); arm_auto_getheaders() accessor for the harness.
  • main_bch.cpp: --auto-kick harness flag — arms the self-start and skips the manual ibd_kick_sync poll.

Off by default: the --ibd evidence harness and manual-drive tests keep prior behaviour; no-peer/RPC-only contract and the BCHN-RPC fallback are untouched.

Verification

  • bch suite 22/22 green (ctest -R ^bch_).
  • c2pool-bch binary builds.
  • Live VM300 .110:8333 read-only on-wire proof (--auto-kick, NO manual kick): handshake -> AUTO getheaders self-started, synced 955700->956034 (peer tip, advanced=yes), in_flight drained 0, false_evict=0, reissue=0, ABLA cursor 955700->956034.

Scope

p2pool-merged-v36 surface: NONE (local SPV wire-sync transport only). src/impl/bch + harness only. VM300 read-only (P2P connect issues no qm op). Merge operator-gated.

…self-start

The verack handler now self-issues the initial getheaders from the
HeaderChain back-off locator when armed, so the embedded P2P node drives
IBD without an external getheaders poll. Production run() arms it in
maybe_start_p2p() (gated on a configured peer); the no-peer/RPC-only
contract and the BCHN-RPC fallback are untouched. Off by default so the
--ibd evidence harness and manual-drive tests keep prior behaviour.

Adds --auto-kick to the --ibd harness: arms the self-start and skips the
manual ibd_kick_sync poll. Live VM300 .110:8333 read-only proof — handshake
-> AUTO getheaders self-started, synced 955700->956034 (peer tip, advanced),
in_flight drained 0, false_evict=0, reissue=0, ABLA cursor 955700->956034.

p2pool-merged-v36 surface: NONE (local SPV wire-sync transport only).
@frstrtr
frstrtr merged commit b8edd37 into master Jun 19, 2026
18 checks 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.

1 participant