Skip to content

multiprocess: Add bitcoin-gui -ipcconnect option#19461

Draft
ryanofsky wants to merge 21 commits intobitcoin:masterfrom
ryanofsky:pr/ipc-gui
Draft

multiprocess: Add bitcoin-gui -ipcconnect option#19461
ryanofsky wants to merge 21 commits intobitcoin:masterfrom
ryanofsky:pr/ipc-gui

Conversation

@ryanofsky
Copy link
Contributor

@ryanofsky ryanofsky commented Jul 7, 2020

This is based on #29409 + #10102 + #19460. The non-base commits are:


Building on #10102, this adds an -ipcconnect option to bitcoin-gui that connects the GUI to an existing bitcoin-node process already running in the background instead of spawning a new bitcoin-node process. This allows the GUI to be started and stopped independently of the node. By default with this change, bitcoin-gui will check if a <datadir>/sockets/node.sock socket exists and try to connect to that. If that doesn't work, it will spawn a new node process and start up the same way it did before this PR.

The default bitcoin-gui connect option is -ipcconnect=auto, which tries to connect if possible as described above, and spawns a new bitcoin-node process if not possible. Other supported options are -noipcconnect to never connect to an existing node and always spawn a new one, -ipcconnect to require a connection and fail if it can't be established, and -ipcconnect=unix:<socket> to require a connection and use a custom socket path.

With this PR, basic functionality works and gui instances can connect and disconnect from a running node. But there are rough edges: If a gui process doesn't shut down cleanly, the node can see unhandled IpcExceptions, and if node command line options are passed to bitcoin-gui and bitcoin-gui connects to an exiting bitcoin-node process instead of spawning a new one, the node options will be silently ignored.

These changes require multiprocess support and this PR has no effect unless bitcoin is configured with --enable-multiprocess as described in doc/multiprocess.md


This PR is part of the process separation project.

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 7, 2020

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/19461.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK laanwj, meshcollider

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #34490 (wallet: Follow-ups to create/load split (Split CWallet::Create() into CreateNew and LoadExisting #32636) by davidgumberg)
  • #34483 (refactor: Use SpanReader over DataStream by maflcko)
  • #34418 (qa: Make wallet_multiwallet.py Windows-compatible by hodlinator)
  • #33585 (cmake: Use builtin support for .manifest files by purpleKarrot)
  • #33034 (wallet: Store transactions in a separate sqlite table by achow101)
  • #32895 (wallet: Prepare for future upgrades by recording versions of last client to open and decrypt by achow101)
  • #32636 (Split CWallet::Create() into CreateNew and LoadExisting by davidgumberg)
  • #32387 (ipc: add windows support by ryanofsky)
  • #32297 (bitcoin-cli: Add -ipcconnect option by ryanofsky)
  • #32138 (wallet, rpc: remove settxfee and paytxfee by polespinasa)
  • #31260 (scripted-diff: Type-safe settings retrieval by ryanofsky)
  • #30342 (kernel, logging: Pass Logger instances to kernel objects by ryanofsky)
  • #29700 (kernel, refactor: return error status on all fatal errors by ryanofsky)
  • #27052 (test: rpc: add last block announcement time to getpeerinfo result by LarryRuane)
  • #26022 (Add util::ResultPtr class by ryanofsky)
  • #25722 (refactor: Use util::Result class for wallet loading by ryanofsky)
  • #25665 (refactor: Add util::Result failure types and ability to merge result values by ryanofsky)
  • #24230 (indexes: Stop using node internal types and locking cs_main, improve sync logic by ryanofsky)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

LLM Linter (✨ experimental)

Possible typos and grammar issues:

  • "connect to the an existing process listening at the specified address." -> "connect to an existing process listening at the specified address." [extra "the" makes the phrase ungrammatical]
  • $Proxy.name("m_transport_type;") -> $Proxy.name("m_transport_type") [trailing semicolon inside the quoted field name appears accidental and could confuse meaning/usage]

2026-01-07

@DrahtBot
Copy link
Contributor

🚧 At least one of the CI tasks failed.
Task lint: https://github.com/bitcoin/bitcoin/actions/runs/19547952463/job/55973101438
LLM reason (✨ experimental): Lint failure: subtree lint check failed due to non-pure subtree.

Hints

Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

ryanofsky and others added 21 commits January 6, 2026 05:45
- Add capnp ToBlob, ToArray, Wrap, Serialize, and Unserialize helper functions
- Add support for std::chrono::seconds capnp serialization
- Add support for util::Result capnp serialization
Expose Chain interface to external processes spawning or connecting to
bitcoin-node.
Needed because BlockConnected notifications are a lot slower with the wallet
running in separate process.
Make default constructor more generic so it doesn't only work with void types.
Libmultiprocess requires output parameters to be ordered after input parameter,
so move warnings parameter last. Problematic order was introduced in
4ec2d18 from
bitcoin-core/gui#877
Spawn node subprocess instead of running node code internally
Spawn wallet subprocess instead of running wallet code internally
Add .wallet/.gui suffixes to log files created by bitcoin-gui and
bitcoin-wallet processes so they don't clash with bitcoin-node log file.
Add `-ipcconnect` option to `bitcoin-wallet` to allow connecting to a bitcoin
node process over IPC.  The `bitcoin-wallet` tool doesn't really do anything with its
connection to the node yet, but it could potentially run or serve RPCs that
require being online.

Example usage:

    src/bitcoin-node -regtest -debug -ipcbind=unix
    src/bitcoin-wallet -regtest -ipcconnect=unix info
Add `-ipcconnect` option to `bitcoin-gui` to allow connecting gui to an
existing node instead of starting a new node process, so it is possible to
start and stop the gui independently of the node.

This change doesn't add an -ipcbind option to the bitcoin-wallet (which would
allow the gui to control wallet processes without going through the node), but
this would be a logical extension to add in the future.
@DrahtBot
Copy link
Contributor

DrahtBot commented Feb 4, 2026

🐙 This pull request conflicts with the target branch and needs rebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.