#30437 ipc: add bitcoin-mine test program
https://github.com/bitcoin/bitcoin/pull/30437 · · +260/-7 in 10 files, 5 commits · labels: IPC
Goal
- Adds test coverage for client-side multiprocess IPC communication that Python tests cannot exercise
- Gives external mining tool developers a reference implementation for calling node interfaces over IPC
This pull request adds an experimental `bitcoin-mine` test executable and a corresponding `feature_mine.py` functional test. The binary connects to `bitcoin-node` over a Unix domain socket using libmultiprocess and exercises `interfaces::Mining` methods, including tip retrieval, template creation, and solution submission. It also wires the command into the `bitcoin` wrapper executable.
Problem: Bitcoin Core lacks an in-tree C++ client binary utilizing `libmultiprocess` to test IPC interfaces against `bitcoin-node`. Existing IPC functional tests use python bindings (PyCap) rather than the C++ client IPC stack, leaving potential client-side serialization and connection regressions untested.
Category: IPC / multiprocess (#13 of 20)
P3 · test coverage
- P3 because it exercises multiprocess IPC on the client side, filling a gap left by Python tests
- Benefits Core developers maintaining IPC infrastructure without affecting standard node operation
P3 because it exercises the libmultiprocess client stack in-tree against bitcoin-node, catching client serialization and connection regressions that Python functional tests miss. As Sjors noted, 'it does still seem useful to have coverage for both libmultiprocess and a bare client'.
Membership: Adds an IPC client program to test unix socket connection and method invocation using libmultiprocess against bitcoin-node.
Factors: security/stability 0, bug 0, performance 0, user value 1, leverage 1
Category: Mining (#10 of 13)
P3 · test coverage
- P3 because it validates block template creation and solution submission across process boundaries
- Unblocks end-to-end testing of mining interfaces over IPC for external mining software authors
P3 because it adds developer-facing test tooling explicitly covered by the mining category rubric (the bitcoin-mine program). It verifies that mining interface methods like createNewBlock and submitSolution work across process boundaries.
Membership: Implements the bitcoin-mine program and exercises interfaces::Mining template generation and solution submission.
Factors: security/stability 0, bug 0, performance 0, user value 1, leverage 0
Reviewability: Ready
- Ready to review; clean rebase, CI is passing, and author addressed all concrete feedback
The code compiles cleanly against master, CI is green, and recent comments have been addressed.
Author status: active, last force-pushed in August 2026
Open concerns:
- The binary is currently built and installed whenever IPC and daemon are enabled; reviewers noted it should have its own CMake flag and not ship in release binaries
- Whether the binary should eventually be converted into a Boost test binary or moved into an examples directory
Resolved concerns:
- Process spawning functionality was dropped from this PR to keep it minimal
- Mining logic was extended to submit solutions on regtest for improved coverage
- Null checks for createNewBlock during node shutdown were added
Agreement: Mild
- Support for adding test coverage for client-side multiprocess IPC (Sjors)
- Verified by testing connection, tip retrieval, and mining on macOS (BrandonOdiwuor)
- Questioned need for an in-tree client and suggested a dedicated CMake option (sedited)
- Noted that the binary should not be distributed in release packages (fanquake)
Mild: Supported by Sjors and ismaelsadeeq, but sedited and fanquake noted it should not ship in releases and needs a dedicated CMake variable (author agreed in principle, change not yet pushed).
Multiple maintainers support the PR for IPC client test coverage, but concerns from fanquake and sedited regarding adding a dedicated CMake option so the binary is not included in releases remain unaddressed in code despite author agreement in principle.
- Sjors (2026-06-30): 'Our functional tests do not use libmultiprocess on the client side... it does still seem useful to have coverage for both libmultiprocess and a bare client.'
- sedited (2026-02-02): 'I think this should get its own variable. If I read this correctly, we would ship this as part of a release with the current configuration?'
- ryanofsky (2026-02-02): 'Yes good catch. This should get it's own variable and not be part of binary releases.'
Objections:
| Reviewer | Kind | Harm | Status | Blocking | Author replied | Quote |
|---|---|---|---|---|---|---|
| fanquake | scope | Shipping experimental test binary in release packages | open | no | yes | 2026-02-02: 'I don't think this is something that needs to be shipped in releases.' |
| sedited | interface | Shipping bitcoin-mine without a dedicated build flag to prevent inclusion in releases | open | no | yes | 2026-02-02: 'I think this should get its own variable. If I read this correctly, we would ship this as part of a release with the current configuration?' |
| Sjors | correctness | Functional test fails on macOS when tmpdir path exceeds 104 bytes. | resolved | no | yes | 2025-03-21: 'On macOS the limit is 104, which I run into when using a RAM disk with --tmpdir=/Volumes/RAMDisk/tmp.' Settled: 2025-03-25: 'ACK 0ec78961915da141b9c68a39ec0ebd5091c13be0' |
| w0xlt | correctness | Mining::createNewBlock() can return nullptr during shutdown or interruption, causing a crash on dereference. | open | no | no | 2026-06-03: 'Mining::createNewBlock() can legally return nullptr when bitcoin-node is shutting down or mining is interrupted.' |
Support:
- Sjors: Provides valuable test coverage for libmultiprocess client interaction with bitcoin-node, which Python functional tests do not exercise
- ismaelsadeeq: Useful usage example and test coverage for the IPC mining interface
- BrandonOdiwuor: Tested IPC connection, tip hash retrieval, and block mining on regtest without errors
Participants: Sjors (support), hebasto (neutral), fanquake (objection), maflcko (neutral), ismaelsadeeq (support), sedited (objection), BrandonOdiwuor (support), ROLANDSIHOMBING1 (neutral), w0xlt (objection)
State derived from the lists: nonblocking objection open (fanquake, sedited, w0xlt)
Review verdicts (DrahtBot): 0 (+3)
- Stale ACK: ismaelsadeeq, BrandonOdiwuor, Sjors
Files
47 lines under test/bench/ci.
- src/bitcoin-mine.cpp +168/-0
- src/bitcoin-mine-res.rc +33/-0
- test/functional/feature_mine.py +33/-0
- src/CMakeLists.txt +14/-1
- contrib/devtools/check-deps.sh +1/-6
- test/functional/test_framework/util.py +5/-0
- src/bitcoin.cpp +3/-0
- CMakeLists.txt +1/-0
- contrib/devtools/gen-manpages.py +1/-0
- test/functional/test_runner.py +1/-0
Card
PR 30437 introduces `bitcoin-mine`, an executable that connects to `bitcoin-node` via IPC using `libmultiprocess` and exercises the `interfaces::Mining` interface. This fills a gap in IPC test coverage, as existing functional tests invoke IPC through Python rather than testing the C++ client stack. Sjors and ismaelsadeeq support merging it for test coverage, while fanquake and sedited raised nonblocking concerns that the test binary needs its own CMake flag to avoid being shipped in binary releases, which the author agreed with but has not yet pushed.