test: journeys for node startup, Tor and I2P, the scripthash index toggle, and the CLI - #802
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
node_listen_and_exitcross_surfacerun_p2p_*tests andstartup_refuses_non_pruned_config_on_pruned_datadirtor_control_onion_lifecyclecross_surfacetor_controltests,i2p_accept_incoming_forwards_to_loopback,electrum_i2p_forward_when_sam_incomingenter_tip_mode_indexescross_surfaceenter_tip_mode_*testsnode_cli_and_surface_smoke(extended) plus node-crateoperator_conf_and_argvscenarios,cli.rscli.rs, 7config.rs, and 1rbitcoin-clitestsnode_listen_and_exit: one datadir, restarted throughrun_p2pwhile its one--connectpeer refuses.peersfile and a missing asmap start an empty book. The saved book then records the refused peer.ip_asn.dat. Esplora, Electrum, and RPC answer at genesis untilstop.--connectresolve none on regtest, and the node exits short of tip mode.--prune-seqsigwitstart, an unpruned start refuses. That refuse now goes throughrun_p2prather thanapply_startup_index_mode.tor_control_onion_lifecycle:run_p2pagainst a fake Tor control port and SAM bridge. Live Tor and i2pd stay in overlay-functional.AUTHENTICATE.--listen-onion,--i2p-accept-incoming, Electrum, and Esplora mints one onion key per service, saved0600, and saves each SAM destination. It sends aSTREAM FORWARDto each port, andgetnetworkinfo.localaddresseslists every address.TorControlandI2pSamwith no node behind them. Nothing checked the portrun_p2phands Tor, or that the address reaches RPC.enter_tip_mode_indexes:--sh-indexoff, on, off, on across restarts of one datadir.run_p2poff the runtime workers, ascli_maindoes: 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.
--datadirwins over confdatadir, and--datadir-coldsplits seqsigwit.rbitcoin-clihelp and version do not dial.operator_conf_and_argv, in place of the parse half of those tests.overlay_configis the precedent.The
TESTING.mdcatalog 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_cancellablestop-during-catch-up beat from the index's coverage notes.Local: fmt, clippy
-D warnings, deny, ast-grep, andci-os-smoke.share green, and so is the workspace suite except one pre-existing race outside this diff.rbitcoin-rpcaddnode_two_nodes_see_each_otherreadspongbytes the moment both peers show ingetpeerinfo. It failed in two of three workspace runs, and passed 5/5 alone and on master.rbitcoin-nettip_burst_past_broadcast_capacity_still_syncs_peermissed its 10s wall once under load and passed alone.🤖 Generated with Claude Code