Review report

core: PR #10102

1 major finding · 11 minor findings · 5 suggestions

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

Findings

Link

[major] · CoinControl maximum depth is serialized as the minimum depth

Default coin control reaches the wallet process with a maximum depth of zero, preventing automatic GUI funding from using confirmed coins.

Location: src/ipc/capnp/wallet.cpp:196 (head).

Details and suggested fix

The builder writes m_min_depth into maxDepth, and the reader independently assigns getMinDepth() to m_max_depth. This changes the default range from [0, 9'999'999] to [0, 0]. AvailableCoins enforces that maximum, so a normal multiprocess GUI send cannot use confirmed outputs through automatic input selection. Without sufficient eligible unconfirmed funds, transaction preparation fails despite the confirmed balance. Explicitly selected inputs can mask the problem. Write m_max_depth with setMaxDepth(), read it with getMaxDepth(), and add a round-trip test with unequal bounds.


Link

[minor] · Reading a WitnessUnknown destination throws bad_variant_access

A third-party payment containing an additional witness v2+ output can persistently prevent multiprocess wallet-history reads.

Location: src/ipc/capnp/wallet.cpp:137 (head).

Details and suggested fix

The witnessUnknown reader calls std::get<WitnessUnknown>(dest) before assigning that alternative. Fresh destinations, including decoded list elements and recipients, start as CNoDestination, so decoding throws std::bad_variant_access. MakeWalletTx extracts destinations from all outputs, including unowned ones. A payment with an additional witness v2+ output therefore makes getWalletTxs fail, and makes getWalletTx and getWalletTxDetails fail for that transaction while it remains stored. GUI sends to such destinations also fail during decoding. How bitcoin-gui surfaces the exception remains unconfirmed. Construct the received WitnessUnknown and assign it to dest, then cover every destination alternative with a round-trip test starting from a default destination.


Link

[minor] · IPC trace logging can write wallet passphrases to debug.log

With IPC trace logging enabled, GUI passphrase calls and forwarded wallet RPC parameters can expose passphrases in debug.log without redaction.

Location: src/ipc/capnp/wallet.capnp:20 (head).

Details and suggested fix

encryptWallet, unlock, changeWalletPassphrase, and the WalletLoader creation and migration methods carry passphrases in ordinary Cap'n Proto fields. Forwarded wallet RPCs likewise carry their JSON parameters through ActorCallback.call. libmultiprocess logs request.toString() on the client and params.toString() on the server at Log::Trace. LogEscape escapes and truncates the payload but does not redact secrets, so exposure depends on field order and length. This requires non-default IPC trace logging, not ordinary IPC debug logging. Skip or redact payload logging for secret-bearing calls and add a regression test asserting that a distinctive passphrase never appears in trace output.


Link

[minor] · Restoring a wallet without loading it aborts bitcoin-node

The multiprocess GUI's restore-and-migrate action hits the Result reader assertion after copying the backup but before starting migration.

Location: src/ipc/capnp/common-types.h:370 (head).

Details and suggested fix

MigrateWalletActivity calls restoreWallet with load_after_restore=false. After copying the backup, RestoreWallet skips LoadWallet, and the loader returns a successful util::Result containing a null unique_ptr<Wallet>. The interface encoder leaves a null capability unset, but the Result decoder requires hasValue() and asserts. Because bitcoin-node relays the wallet-loader interface, it decodes this reply and aborts before the GUI can continue to migration. Assertions remain enabled in release builds. Represent successful nullable values independently of pointer presence, or explicitly construct an empty nullable value when decoding this success case, and test the no-load restore over IPC.


Link

[minor] · An omitted setAddressBook purpose is read as RECEIVE

Changing an existing sending contact's label during a multiprocess GUI send overwrites its stored purpose with RECEIVE.

Location: src/ipc/capnp/wallet.capnp:34 (head).

Details and suggested fix

purpose :Int32 has no matching hasPurpose field, so the generated scalar accessor reports it present even when the optional writer leaves it unset. WalletModel::sendCoins passes std::nullopt for a label-only update, but the server reads the default zero as an engaged AddressPurpose::RECEIVE. SetAddressBookWithDB then updates and persists that purpose instead of preserving SEND. Add hasPurpose :Bool so the existing optional handling preserves absence, and test that a label-only IPC update leaves a sending contact's purpose unchanged.


Link

[minor] · Wallet scheduler outlives the WalletContext used by its callback

A resend tick during wallet-loader teardown can lock a destroyed mutex in bitcoin-wallet.

Location: src/ipc/capnp/wallet.cpp:88 (head).

Details and suggested fix

StartWallets schedules a minute-based callback capturing the loader's WalletContext by reference. That callback calls GetWallets, which locks context.wallets_mutex. Both explicit proxy destruction and asynchronous disconnect cleanup destroy the loader before running the cleanup function that stops and joins SchedulerThread; neither wallet unloading nor the defaulted context destructor cancels the callback. FIFO cleanup also deletes the chain proxy before stopping the scheduler, widening the interval. A tick in that interval accesses destroyed state. Stop and join the scheduler before destroying the loader's context on both teardown paths, for example by giving the loader ownership of the scheduler with that destruction order.


Link

[minor] · IPC passphrase copies have no explicit cleansing path

GUI wallet passphrases enter ordinary IPC buffers without an explicit cleansing path, including copies decoded and re-encoded inside bitcoin-node.

Location: src/ipc/capnp/common-types.h:197 (head).

Details and suggested fix

CustomBuildField<SecureString> copies passphrases into Cap'n Proto storage, and the reader copies them back out. Both hooks require callers to cleanse that storage, but the IPC callers do not do so. The GUI obtains its WalletLoader through bitcoin-node, which wraps the spawned wallet's client in another server, so GUI passphrase calls also create message copies in the network-facing node process. Those copies lack SecureString's explicit cleanse-on-free guarantee; Cap'n Proto's underlying erasure behavior has not been established. Give secret-bearing message segments a defined cleansing lifetime covering success, error, and cancellation paths. A direct GUI-to-wallet capability would additionally avoid the node copies.


Link

[minor] · Published makeWalletLoader dispatch can reinitialize and abort a running node

On wallet-enabled bitcoin-node, an -ipcbind client can invoke makeWalletLoader to overwrite process settings and reach a null-implementation assertion.

Location: src/ipc/capnp/init.capnp:37 (head).

Details and suggested fix

The listener exposes the same Init object used for spawned-process initialization. Before makeWalletLoader runs, its GlobalArgs adapter calls ReadGlobalArgs, replacing settings, calling SelectParams, and rerunning logging and parameter interaction without checking whether the process is already initialized. The custom wallet-enabled invocation then calls bitcoin-node's inherited makeWalletLoader, which returns null, and wraps it in a server whose constructor asserts m_impl. This is a robustness failure for already-trusted IPC clients, not an authentication bypass. Reject startup-only initialization on an initialized or non-parent connection before applying GlobalArgs, and return an error rather than constructing a server for a null implementation.


Link

[minor] · Wallet RPCs registered over IPC lose their OpenRPC metadata

When bitcoin-node uses the spawned wallet, getopenrpcinfo and rpc.discover omit wallet methods even though those methods remain callable.

Location: src/ipc/capnp/chain.cpp:185 (head).

Details and suggested fix

WalletLoaderImpl::registerRpcs preserves each command's metadata_fn, but RPCCommand transports only its category, name, actor, arguments, and unique ID. HandleRpc reconstructs the command with the five-argument constructor, leaving metadata_fn=nullptr. CRPCTable::buildOpenRPCDoc skips those commands, so discovery loses all wallet methods registered through this path. Carry the method metadata over IPC, for example through a callback that produces a serializable metadata representation, and add a multiprocess assertion that a wallet method appears in getopenrpcinfo.


Link

[minor] · CoinControl lock time, version, and maximum weight are dropped over IPC

The codec discards these three transaction settings because their presence flags remain unset; no current IPC caller supplying non-default values was identified.

Location: src/ipc/capnp/wallet.cpp:198 (head).

Details and suggested fix

The builder writes lockTime, version, and maxTxWeight without setting hasLockTime, hasVersion, or hasMaxTxWeight. The reader applies each field only when its flag is nonzero, so a fresh wallet-side control instead retains no explicit lock time, the default transaction version, and no weight cap. A caller supplying different values would therefore construct a transaction without those requested settings. No current IPC caller setting them was identified, so production impact remains unconfirmed; the GUI appears to use defaults and wallet RPCs execute inside the wallet process. Set each presence flag when writing its value and cover these fields in a round-trip test.


Link

[minor] · ProxyInfo omits the Unix-socket proxy fields

With a Unix-socket proxy configured, the multiprocess GUI loses its path and shows the corresponding proxy reachability indicators as unchecked.

Location: src/ipc/capnp/node.capnp:139 (head).

Details and suggested fix

ProxyInfo carries the CService and stream-isolation flag but drops m_unix_socket_path and m_is_unix_socket. The GUI consequently receives a default CService with the Unix-socket discriminator false. Its ToString() no longer returns the configured socket path, so OptionsDialog::updateDefaultProxyNets cannot match it to the proxy setting. This affects reporting for Unix-socket proxies, not the node's actual routing. Serialize and restore both omitted fields in ProxyInfo.


Link

[minor] · Default subtree checks no longer fail on content mismatches

The temporary libmultiprocess exception also lets unannounced edits to secp256k1, minisketch, and other subtrees pass the default check.

Location: test/lint/git-subtree-check.sh:115 (head).

Details and suggested fix

The mismatch branch still prints FAIL: subtree directory was touched without subtree merge, but commenting out exit 1 lets it fall through to echo "GOOD" with status zero. Nothing restricts this exception to libmultiprocess. The optional -r upstream comparison can still fail, but it does not preserve the default local-tree integrity check. Restore the failing exit and scope any temporary exception to the intended libmultiprocess paths or commits.


Optional improvements

Link

[suggestion] · The wallet scheduler worker may be deferred until destruction

The default std::async policy permits deferred execution, which would leave scheduled wallet work unserviced without reporting a worker-creation error.

Location: src/ipc/capnp/wallet.cpp:54 (head).

Details and suggested fix

SchedulerThread promises a worker thread but calls std::async without a launch policy. If the implementation chooses deferred execution, nothing starts serviceQueue() while the wallet loader is alive. The only get() runs after m_scheduler.stop(), so the deferred function then exits without processing callbacks, including periodic wallet rebroadcast. Pass std::launch::async to require asynchronous execution and turn an inability to create the worker into an error.


Link

[suggestion] · The Clang fallback also disables unrelated C++23 diagnostics

Compilers accepting the narrow lambda-attribute flag still receive the broad C++23 extension suppression.

Location: CMakeLists.txt:521 (head).

Details and suggested fix

The comment describes -Wno-c++23-extensions as a fallback for older Clang versions, but both try_append_cxx_flags calls run independently. A compiler accepting both options therefore suppresses unrelated C++23 extension diagnostics throughout warn_interface, weakening detection of accidental extensions in this C++20 codebase. Capture the narrow check with RESULT_VAR and add the broad suppression only when that check fails.


Link

[suggestion] · Wallet and GUI log paths hardcode regtest

combine_logs.py silently omits wallet and GUI logs when a functional test uses another chain directory.

Location: test/functional/combine_logs.py:104 (head).

Details and suggested fix

read_logs detects the chain directory and uses it to locate each node's debug.log, but the new debug.log.wallet and debug.log.gui paths always point into regtest. When the detected chain is signet, testnet4, or another directory, the auxiliary logs are not added to the combined output. Use the detected chain in both format strings, as the node-log path already does.


Link

[suggestion] · Multiprocess documentation still places the process split in the future

The usage section describes the process layout introduced here as work that will happen after this PR.

Location: doc/multiprocess.md:50 (head).

Details and suggested fix

The usage text says multiprocess binaries differ only by supporting -ipcbind, then places the GUI/node/wallet split after #10102. This is stale with the new process layout; for example, bitcoin-node already spawns bitcoin-wallet when wallet operation is enabled. Rewrite this section to describe the current layout, retaining the wallet-disabled qualification and keeping the -ipcconnect follow-ups as future work.


Link

[suggestion] · The new private-key codec has no schema caller

The unused Key struct and CKey conversions add a private-key wire representation without supporting any wallet method.

Location: src/ipc/capnp/wallet.cpp:157 (head).

Details and suggested fix

wallet.capnp declares Key, and the C++ wrappers add matching CKey encode/decode overloads, but no schema field or method parameter selects that type. addHDKey uses Data instead. Keeping this unused representation adds maintenance and review cost without serving current transport behavior. Remove the struct, the two declarations, and the two definitions.


Coverage details

Earlier concerns

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