Skip to content

test: journeys for node startup, Tor and I2P, the scripthash index toggle, and the CLI - #802

Merged
reardencode merged 5 commits into
masterfrom
test/node-journeys
Sep 28, 2026
Merged

reardencode merged 5 commits into
masterfrom
test/node-journeys

Conversation

@rearden-grok

@rearden-grok rearden-grok Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Section 9 of the journey-fold index: node CLI, tip mode, and startup. Four journeys and one crate test replace 56 package tests. Each journey drives the node the way an operator does and asserts what the operator sees.

Journey Where Replaces
node_listen_and_exit cross_surface 10 run_p2p_* tests and startup_refuses_non_pruned_config_on_pruned_datadir
tor_control_onion_lifecycle cross_surface 10 tor_control tests, i2p_accept_incoming_forwards_to_loopback, electrum_i2p_forward_when_sam_incoming
enter_tip_mode_indexes cross_surface 6 enter_tip_mode_* tests
node_cli_and_surface_smoke (extended) plus node-crate operator_conf_and_argv scenarios, cli.rs 19 cli.rs, 7 config.rs, and 1 rbitcoin-cli tests

node_listen_and_exit: one datadir, restarted through run_p2p while its one --connect peer refuses.

  • A junk peers file and a missing asmap start an empty book. The saved book then records the refused peer.
  • The next start loads that book and a valid ip_asn.dat. Esplora, Electrum, and RPC answer at genesis until stop.
  • An Electrum port that another process holds only warns.
  • Seeds with no --connect resolve none on regtest, and the node exits short of tip mode.
  • After a --prune-seqsigwit start, an unpruned start refuses. That refuse now goes through run_p2p rather than apply_startup_index_mode.

tor_control_onion_lifecycle: run_p2p against a fake Tor control port and SAM bridge. Live Tor and i2pd stay in overlay-functional.

  • A cookie from another Tor, a 2-byte cookie, and a Tor that offers only plain COOKIE each refuse the start without sending AUTHENTICATE.
  • Password auth with --listen-onion, --i2p-accept-incoming, Electrum, and Esplora mints one onion key per service, saved 0600, and saves each SAM destination. It sends a STREAM FORWARD to each port, and getnetworkinfo.localaddresses lists every address.
  • A SAFECOOKIE restart reuses the saved keys and destinations.
  • The old tests called TorControl and I2pSam with no node behind them. Nothing checked the port run_p2p hands Tor, or that the address reaches RPC.

enter_tip_mode_indexes: --sh-index off, on, off, on across restarts of one datadir.

  • Blocks mined with the index off are collected from Class A on the first start with it on.
  • Turning the index off closes Electrum.
  • After a crash leaves a collect run and a lagging include high-water mark, the durable index resumes under write-behind. The run is discarded, not merged, and the next block lands in history.
  • This journey spawns run_p2p off the runtime workers, as cli_main does: an empty datadir connects genesis through tip-accept, which refuses a worker thread.

CLI: the smoke journey now owns every exit code and datadir effect.

  • Usage errors exit 2 before a datadir is touched. That covers every concatenated, one-dash, and Core spelling.
  • Conf refusals exit 2 and open no store.
  • Validate refusals exit 1.
  • One start takes the native flag set together, CLI --datadir wins over conf datadir, and --datadir-cold splits seqsigwit.
  • rbitcoin-cli help and version do not dial.
  • The values argv and the conf file assemble (defaults, the milestone anchor, listen ports, help text) are reported by no running surface. They stay as one node-crate test, operator_conf_and_argv, in place of the parse half of those tests. overlay_config is the precedent.

The TESTING.md catalog gains the three new rows and the extended smoke row. The external-findings regression pointers for 042 and 044 now name these journeys.

Not in this PR: the optional ibd_cancellable stop-during-catch-up beat from the index's coverage notes.

Local: fmt, clippy -D warnings, deny, ast-grep, and ci-os-smoke.sh are green, and so is the workspace suite except one pre-existing race outside this diff. rbitcoin-rpc addnode_two_nodes_see_each_other reads pong bytes the moment both peers show in getpeerinfo. It failed in two of three workspace runs, and passed 5/5 alone and on master. rbitcoin-net tip_burst_past_broadcast_capacity_still_syncs_peer missed its 10s wall once under load and passed alone.

🤖 Generated with Claude Code

reardencode and others added 5 commits September 28, 2026 08:12
node_listen_and_exit restarts one operator datadir through run_p2p
while its one --connect peer refuses. A junk peers file and a missing
asmap start an empty book, and the saved book then records the refused
peer. The next start loads that book and a valid ip_asn.dat, and
Esplora, Electrum and RPC answer at genesis until stop. An Electrum port
another process holds only warns. Without --connect and with seeds on,
regtest resolves none and the node exits short of tip mode. After a
--prune-seqsigwit start, an unpruned start refuses.

Ten run_p2p_* tests each opened a fresh datadir for one of those arms
and asserted only that run_p2p returned. The prune refuse called
apply_startup_index_mode directly; it now goes through run_p2p.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tor_control_onion_lifecycle starts one datadir against a fake Tor
control port and SAM bridge. A cookie from another Tor, a 2-byte cookie,
and a Tor that offers only plain COOKIE each refuse the start without
sending AUTHENTICATE. Password auth with --listen-onion,
--i2p-accept-incoming, Electrum, and Esplora mints one onion key per
service. Each key is saved 0600, each SAM destination is saved, a
STREAM FORWARD goes to each port, and getnetworkinfo lists every
address. A SAFECOOKIE restart reuses the saved keys and destinations.

The ten tor_control tests and the two I2P forward tests called
TorControl, I2pSam, or start_i2p_named_forward directly, with no node
behind them. Nothing checked that run_p2p asks Tor for the right port,
or that the address lands in getnetworkinfo. Live Tor and i2pd stay
overlay-functional.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
enter_tip_mode_indexes restarts one run_p2p datadir with --sh-index
off, on, off, on. Blocks mined while the index is off are collected
from Class A on the first start with it on, and Electrum serves their
history. Turning it off closes Electrum. A crash leaves a collect run
and a lagging include high-water mark behind. Turning the index back on
resumes the durable index under write-behind: the run is discarded, not
merged, and the next block lands in history.

The six enter_tip_mode_* tests each opened a store and called
enter_tip_mode against a synthetic chain to read IndexMode and the gate
flags. run_p2p is spawned off the runtime workers, as cli_main blocks on
it, because an empty datadir connects genesis through tip-accept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
node_cli_and_surface_smoke now owns what an operator sees from argv and
a conf file. Usage errors, including every concatenated and Core
spelling, exit 2 before a datadir is touched. A conf file that is
missing, has a bad line, a bad log_level, rpcuser, rpcpassword, or
max_outbound=0 exits 2 and opens no store. Flags that describe a node
that cannot run exit 1: non-hex --min-chain-work, a signet challenge
off signet, a signet block time with no challenge, and tweaks with
seqsigwit pruning. One smoke takes the native flag set together. CLI
--datadir wins over conf datadir. --datadir-cold puts seqsigwit on the
cold store. rbitcoin-cli help and version do not dial.

Twenty cli.rs, config.rs, and rbitcoin-cli tests covered those needles,
and nine of them opened their own store. The values argv and the conf
assemble (defaults, milestone anchor, listen ports, help text) are not
reported by any running surface. They stay as one node-crate test,
operator_conf_and_argv, in place of fifteen parse tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
node_listen_and_exit and tor_control_onion_lifecycle spawned run_p2p on
a runtime worker and inlined the stop-and-join. They now use the same
spawn_run_p2p and stop_run_p2p as enter_tip_mode_indexes. That runs
run_p2p off the workers, as cli_main does, and one stop path reports
why a node did not exit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@reardencode
reardencode merged commit d85f542 into master Sep 28, 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