torcontrol: Improve connection logging

bitcoin/bitcoin: PR #36759

1 suggestion

Earlier concerns neither republished nor resolved: 1 suggestion. See the Run archive for their assessments.

Optional improvements

Link

[suggestion] · Unconfigured Tor-control failures lack a logging regression test

The new failure test only exercises explicitly configured Tor control, so restoring warning or Info-level logging for unconfigured connection failures would not fail its assertions.

Location: test/functional/feature_torcontrol.py:297 (head).

Details and suggested fix

test_connect_failure_warning and restart_with_mock both set -torcontrol and -listenonion=1, making tor_control_configured true. Other functional nodes default to listenonion=0, which disables the controller. Also, because functional nodes run with -debug, the unqualified connect() ... failed expectation accepts netbase's debug form and does not pin the configured path's Info level.

Add a deterministic unit test using BasicTestingSetup and a temporary CreateSock replacement whose socket reports connection refusal from Connect(). Call TorControlConnection::Connect with false, require the [tor] and [net] debug messages, and reject the warning and uncategorized Info forms. Repeat with true to check the configured levels, then restore CreateSock. Returning nullptr instead would bypass LogConnectFailure and leave manual_connection untested. This covers the logging distinction without depending on a local Tor instance, though the init.cpp configuration predicate would still need separate coverage.


Coverage details

Earlier concerns

Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.