Skip to content

Commit 012f347

Browse files
committed
Merge bitcoin/bitcoin#31375: multiprocess: Add bitcoin wrapper executable
a5ac43d doc: Add release notes describing bitcoin wrapper executable (Ryan Ofsky) 258bda8 doc: Mention bitcoin wrapper executable in documentation (Ryan Ofsky) d2739d7 build: add bitcoin.exe to windows installer (Sjors Provoost) ba649c0 ci: Run multiprocess tests through wrapper executable (Ryan Ofsky) 29bdd74 test: Support BITCOIN_CMD environment variable (Ryan Ofsky) 9c8c688 multiprocess: Add bitcoin wrapper executable (Ryan Ofsky) 5076d20 util: Add cross-platform ExecVp and GetExePath functions (Ryan Ofsky) Pull request description: Intended to make bitcoin command line features more discoverable and allow installing new multiprocess binaries in libexec/ instead of bin/ so they don't cause confusion. Idea and implementation of this were discussed in bitcoin/bitcoin#30983. --- Initial implementation of this feature is deliberately minimal so the UX can evolve in response to feedback and there are not too many details to debate and discuss in a single PR. But many improvements are possible or planned: - Adding manpage and bash completions. - Showing nicer error messages that detect if an executable isn't installed and suggest how to fix [(comment)](bitcoin/bitcoin#31375 (comment)) - Showing wrapper command lines in subcommand in help output [(comment)](bitcoin/bitcoin#31375 (comment)). This could be done conditionally as suggested in the comment or be unconditional. - Showing wrapper command lines in subcommand error output. There is a bitcoin-cli error pointed out in [(comment)](bitcoin/bitcoin#31375 (comment)) that is needlessly confusing. - Integrating help so `bitcoin help subcommand` invokes `bitcoin subcommand -h`. `bitcoin -h subcommand` should also be supported and be equivalent [(comment)](bitcoin/bitcoin#31375 (comment)) - Adding support for `bitcoin-util` subcommands. Ideal interface would probably be more like `bitcoin grind` not `bitcoin util grind` but this has been punted for now. Supporting subcommands directly would require some ArgsManager modifications - Adding a dedicated python functional test for the wrapper. Right now there is some CI coverage by setting the `BITCOIN_CMD` variable, but this doesn't cover things like the help output and version output, and support for different directory layouts. - Better `--multiprocess` (`-m`) / `--monolithic` (`-M`) default selection. Right now, default is monolithic but it probably makes sense to chose more intelligently depending on whether -ipc options are enabled and what binaries are available. - Maybe parsing `bitcoin.conf` and supporting options to control wrapper behavior like custom locations or preferences or aliases. - Better command command line usability. Allow combining short options like (`-ah`). Allow fuzzy matching of subcommands or suggestions if you misspell. (suggested by stickies in review club) - Not directly related to this PR but `bitcoin-cli named` implementation used by the wrapper should do a better job disambiguating named arguments from base64 arguments ending in = as pointed out in [(comment)](bitcoin/bitcoin#31375 (comment)) --- This PR is part of the [process separation project](bitcoin/bitcoin#28722). A review club meeting for it took place in https://bitcoincore.reviews/31375 ACKs for top commit: Sjors: utACK a5ac43d achow101: ACK a5ac43d vasild: ACK a5ac43d theStack: ACK a5ac43d ismaelsadeeq: fwiw my last review implied an ACK a5ac43d hodlinator: ACK a5ac43d Tree-SHA512: 570e6a4ff8bd79ef6554da3d01f36c0a7c6d2dd7dace8f8732eca98f4a8bc2284474a9beadeba783114fe2f3dd08b2041b3da7753bae0b7f881ec50668cb821f
2 parents 38ad802 + a5ac43d commit 012f347

26 files changed

+393
-22
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ endif()
9494
#=============================
9595
include(CMakeDependentOption)
9696
# When adding a new option, end the <help_text> with a full stop for consistency.
97+
option(BUILD_BITCOIN_BIN "Build bitcoin executable." ON)
9798
option(BUILD_DAEMON "Build bitcoind executable." ON)
9899
option(BUILD_GUI "Build bitcoin-qt executable." OFF)
99100
option(BUILD_CLI "Build bitcoin-cli executable." ON)
@@ -202,6 +203,7 @@ target_link_libraries(core_interface INTERFACE
202203

203204
if(BUILD_FOR_FUZZING)
204205
message(WARNING "BUILD_FOR_FUZZING=ON will disable all other targets and force BUILD_FUZZ_BINARY=ON.")
206+
set(BUILD_BITCOIN_BIN OFF)
205207
set(BUILD_DAEMON OFF)
206208
set(BUILD_CLI OFF)
207209
set(BUILD_TX OFF)
@@ -647,6 +649,7 @@ message("\n")
647649
message("Configure summary")
648650
message("=================")
649651
message("Executables:")
652+
message(" bitcoin ............................. ${BUILD_BITCOIN_BIN}")
650653
message(" bitcoind ............................ ${BUILD_DAEMON}")
651654
if(BUILD_DAEMON AND ENABLE_IPC)
652655
set(bitcoin_daemon_status ON)

ci/test/00_setup_env_i686_multiprocess.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ export BITCOIN_CONFIG="\
2020
-DCMAKE_CXX_COMPILER='clang++;-m32' \
2121
-DAPPEND_CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE' \
2222
"
23-
export BITCOIND=bitcoin-node # Used in functional tests
23+
export BITCOIN_CMD="bitcoin -m" # Used in functional tests

cmake/module/GenerateSetupNsi.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ function(generate_setup_nsi)
77
set(abs_top_builddir ${PROJECT_BINARY_DIR})
88
set(CLIENT_URL ${PROJECT_HOMEPAGE_URL})
99
set(CLIENT_TARNAME "bitcoin")
10+
set(BITCOIN_WRAPPER_NAME "bitcoin")
1011
set(BITCOIN_GUI_NAME "bitcoin-qt")
1112
set(BITCOIN_DAEMON_NAME "bitcoind")
1213
set(BITCOIN_CLI_NAME "bitcoin-cli")

cmake/module/Maintenance.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function(add_maintenance_targets)
2323
return()
2424
endif()
2525

26-
foreach(target IN ITEMS bitcoind bitcoin-qt bitcoin-cli bitcoin-tx bitcoin-util bitcoin-wallet test_bitcoin bench_bitcoin)
26+
foreach(target IN ITEMS bitcoin bitcoind bitcoin-qt bitcoin-cli bitcoin-tx bitcoin-util bitcoin-wallet test_bitcoin bench_bitcoin)
2727
if(TARGET ${target})
2828
list(APPEND executables $<TARGET_FILE:${target}>)
2929
endif()
@@ -43,7 +43,7 @@ function(add_maintenance_targets)
4343
endfunction()
4444

4545
function(add_windows_deploy_target)
46-
if(MINGW AND TARGET bitcoin-qt AND TARGET bitcoind AND TARGET bitcoin-cli AND TARGET bitcoin-tx AND TARGET bitcoin-wallet AND TARGET bitcoin-util AND TARGET test_bitcoin)
46+
if(MINGW AND TARGET bitcoin AND TARGET bitcoin-qt AND TARGET bitcoind AND TARGET bitcoin-cli AND TARGET bitcoin-tx AND TARGET bitcoin-wallet AND TARGET bitcoin-util AND TARGET test_bitcoin)
4747
find_program(MAKENSIS_EXECUTABLE makensis)
4848
if(NOT MAKENSIS_EXECUTABLE)
4949
add_custom_target(deploy
@@ -59,6 +59,7 @@ function(add_windows_deploy_target)
5959
add_custom_command(
6060
OUTPUT ${PROJECT_BINARY_DIR}/bitcoin-win64-setup.exe
6161
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/release
62+
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:bitcoin> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:bitcoin>
6263
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:bitcoin-qt> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:bitcoin-qt>
6364
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:bitcoind> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:bitcoind>
6465
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:bitcoin-cli> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:bitcoin-cli>

contrib/guix/security-check.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ def check_ELF_FORTIFY(binary) -> bool:
126126
# bitcoin-util does not currently contain any fortified functions
127127
if 'Bitcoin Core bitcoin-util utility version ' in binary.strings:
128128
return True
129+
# bitcoin wrapper does not currently contain any fortified functions
130+
if '--monolithic' in binary.strings:
131+
return True
129132

130133
chk_funcs = set()
131134

doc/JSON-RPC-interface.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ bitcoin-cli -named createwallet wallet_name=mywallet load_on_startup=true
6262
bitcoin-cli -named createwallet mywallet load_on_startup=true
6363
```
6464

65+
`bitcoin rpc` can also be substituted for `bitcoin-cli -named`, and is a newer alternative.
66+
6567
## Versioning
6668

6769
The RPC interface might change from one major version of Bitcoin Core to the

doc/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ Unpack the files into a directory and run:
1717

1818
- `bin/bitcoin-qt` (GUI) or
1919
- `bin/bitcoind` (headless)
20+
- `bin/bitcoin` (wrapper command)
21+
22+
The `bitcoin` command supports subcommands like `bitcoin gui`, `bitcoin node`, and `bitcoin rpc` exposing different functionality. Subcommands can be listed with `bitcoin help`.
2023

2124
### Windows
2225

doc/build-osx.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ cmake --build build --target deploy
199199
Bitcoin Core should now be available at `./build/bin/bitcoind`.
200200
If you compiled support for the GUI, it should be available at `./build/bin/bitcoin-qt`.
201201

202+
There is also a multifunction command line interface at `./build/bin/bitcoin`
203+
supporting subcommands like `bitcoin node`, `bitcoin gui`, `bitcoin rpc`, and
204+
others that can be listed with `bitcoin help`.
205+
202206
The first time you run `bitcoind` or `bitcoin-qt`, it will start downloading the blockchain.
203207
This process could take many hours, or even days on slower than average systems.
204208

doc/build-unix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,5 @@ This example lists the steps necessary to setup and build a command line only di
174174
cmake --build build
175175
ctest --test-dir build
176176
./build/bin/bitcoind
177+
./build/bin/bitcoin help
177178

doc/cjdns.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,5 @@ To see which CJDNS peers your node is connected to, use `bitcoin-cli -netinfo 4`
113113
or the `getpeerinfo` RPC (i.e. `bitcoin-cli getpeerinfo`).
114114

115115
You can use the `getnodeaddresses` RPC to fetch a number of CJDNS peers known to your node; run `bitcoin-cli help getnodeaddresses` for details.
116+
117+
`bitcoin rpc` can also be substituted for `bitcoin-cli`.

0 commit comments

Comments
 (0)