Review report

core: PR #34038

3 minor findings · 2 suggestions

Earlier concerns neither republished nor resolved: 2 minor findings. See the Run archive for their assessments.

Findings

Link

[minor] · Runtime trace changes do not enable tracing on existing wallets or IPC loops

Calling logging to enable walletdb or ipc tracing does not update an open wallet or running IPC loop, so the requested diagnostic output remains unavailable until the relevant component is recreated or restarted.

Location: src/rpc/node.cpp:297 (head).

Details and suggested fix

The logging RPC changes logger state, but SQLite installs its trace callback only when the wallet connection opens and walletdb tracing is already enabled. An already-open wallet therefore emits no SQL trace lines after the RPC call; unloading and reloading the wallet enables them. The IPC event loop similarly reads its requested log level only when it starts, and libmultiprocess drops messages below that stored level. With -ipcbind, the loop starts before the RPC server, so enabling ipc tracing later does not affect it. The open-time checks predate this change, but this PR adds runtime trace switching and documents it as a feature. For wallet tracing, install the SQLite callback unconditionally and return before formatting SQL when tracing is disabled. For IPC, refresh the loop's level when it changes, or document that a restart is required.


Link

[minor] · No-log-file contexts leave trace logging enabled in hot loops

Fuzzing and benchmark contexts created by MakeNoLogFileContext enable all trace categories, adding debug-only work and formatting messages that are discarded; the slowdown has not been measured.

Location: src/test/util/setup_common.cpp:167 (head).

Details and suggested fix

BasicTestingSetup now passes a bare -trace, which enables all categories. MakeNoLogFileContext adds -nodebug but not -notrace; -nodebug clears only -debug options, so tracing remains enabled for every category except leveldb. Code guarded by ShouldDebugLog or ShouldTraceLog can therefore do extra work, and messages are formatted before the logger drops them because there is no output. For example, compact-block debug logging makes PartiallyDownloadedBlock::InitData perform additional size and redundancy bookkeeping during BlockEncodingBench. Add -notrace alongside -nodebug before opts.extra_args, so callers can still opt back into tracing.


Link

[minor] · The -loglevel option is removed without a deprecation period

Existing command-line uses now prevent startup, while configuration-file uses are ignored and lose their requested logging levels; the number of affected users is unknown.

Location: src/init/common.cpp:37 (base).

Details and suggested fix

This change removes the -loglevel registration and parser. After upgrading, a command-line argument such as -loglevel=walletdb:trace is rejected as an invalid parameter, preventing startup. A loglevel= entry in bitcoin.conf is instead reported as an unknown configuration value, and its requested logging level is silently lost. The release note announces the removal, but the developer notes call for at least one major release of grace and a startup warning when a startup option is deprecated. Although -loglevel was DEBUG_ONLY, the stated policy makes no exception for it. Keep the option registered for one release, warn that it is deprecated and point users to -debug and -trace, then apply its levels after processing those options. The existing level parsers make this compatibility shim small. No checked-in configuration using the option was found, so the number of affected users is unknown.


Optional improvements

Link

[suggestion] · The release note incorrectly says wallet SQL is the only supported trace output

The new -trace option also enables cmpctblock and ipc trace messages, including when invoked with -trace=1.

Location: doc/release-notes-34038.md:4 (head).

Details and suggested fix

The release note says wallet SQL statements are the only supported trace logs. However, blockencodings.cpp and net_processing.cpp emit cmpctblock trace messages listing requested transaction IDs, and IpcLogFn forwards libmultiprocess trace messages through the ipc category. The options -trace=cmpctblock, -trace=ipc, and -trace=1 enable those messages. Present walletdb as an example, or name the other supported categories.


Link

[suggestion] · The -trace help misstates how 0 and none handle categories

0 and none discard categories listed before the last such value, but categories listed after it still apply.

Location: src/init/common.cpp:33 (head).

Details and suggested fix

The help says that when the category is 0 or none, all other categories are ignored. In fact, initialization drops only the entries before the last -trace=0 or -trace=none and processes later entries. The functional test demonstrates this: -trace=http, -trace=0, -trace=rpc, and -trace=net leave rpc and net traced. A user adding -trace=0 can therefore still enable tracing with a later -trace=<category>. Clarify that 0 or none clears the trace categories given before it. The edited -debug help uses the same wording and needs the same correction.


Coverage details

Earlier concerns

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