-
Notifications
You must be signed in to change notification settings - Fork 37.7k
multiprocess: Don't require bitcoin -m argument when IPC options are used #33229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Expose ENABLE_IPC build option to functional tests so new tests can test IPC-only features.
Set new `BitcoinTestFramework.binary_paths.bitcoin_bin` property with path to the `bitcoin` wrapper binary. This allows new tests for `bitcoin-mine` in bitcoin#30437 and `bitcoin-cli` in bitcoin#32297 to find the `bitcoin` binary and call `bitcoin -m` to start nodes with IPC support. This way the new tests can run whenever the ENABLE_IPC build option is enabled, instead of only running when the `BITCOIN_CMD` environment variable is set to `bitcoin -m`
…le to distinguish these in tests
Choose the right binary by default if an IPC option is specified
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33229. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
Concept ACK This also makes it easier to document instructions for miners, they just need to drop the "d" from The help text should explain that |
The following patches fix the linter: iff --git a/src/bitcoin.cpp b/src/bitcoin.cpp
index c1a5fce33a..aa74f3e54e 100644
--- a/src/bitcoin.cpp
+++ b/src/bitcoin.cpp
@@ -166,7 +166,7 @@ bool UseMultiprocess(const CommandLine& cmd)
// If any -ipc* options are set these need to be processed by a
// multiprocess-capable binary.
- return args.IsArgSet("-ipcbind") || args.IsArgSet("-ipcconnect") || args.IsArgSet("-ipcfd");
+ return args.IsArgSet("-ipcbind");
}
//! Execute the specified bitcoind, bitcoin-qt or other command line in `args`
diff --git a/test/functional/tool_bitcoin.py b/test/functional/tool_bitcoin.py
index 7ceb6c85b3..a6cce2339a 100755
--- a/test/functional/tool_bitcoin.py
+++ b/test/functional/tool_bitcoin.py
@@ -3,7 +3,6 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the IPC interface."""
-from pathlib import Path
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
append_config,
@@ -63,7 +62,7 @@ class ToolBitcoinTest(BitcoinTestFramework):
self.test_args([], ["-ipcbind=unix"], expect_exe="bitcoin-node")
self.log.info("Ensure bitcoin recognizes -ipcbind in config file")
- append_config(node.datadir_path, [f"ipcbind=unix"])
+ append_config(node.datadir_path, ["ipcbind=unix"])
self.test_args([], [], expect_exe="bitcoin-node") As for the macOS error I can't reproduce:
However you might need the same workaround for long |
|
||
// If any -ipc* options are set these need to be processed by a | ||
// multiprocess-capable binary. | ||
return args.IsArgSet("-ipcbind") || args.IsArgSet("-ipcconnect") || args.IsArgSet("-ipcfd"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5a28d0b: did you mean to add -ipcconnect
and -ipcfd
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re: #33229 (comment)
5a28d0b: did you mean to add
-ipcconnect
and-ipcfd
here?
Yeah they are not necessary but listed to be more future-proof. It makes sense for any IPC options to choose the IPC binary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I asked because it triggered a missing documentation error.
src/init/bitcoin-qt.cpp
Outdated
@@ -16,6 +16,8 @@ | |||
|
|||
namespace init { | |||
namespace { | |||
const char* EXE_NAME = "bitcoin-node"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
231fba1: I'm confused, should this be bitcoin-qt
?
I don't see it appear when I run build/bin/bitcoin gui --version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re: #33229 (comment)
Good catch, changed to bitcoin-qt. Also good to know text doesn't appear in gui --version output but I think that is ok as long as the test is only calling bitcoin node. I do think it's probably good for the Init::exeName method to return the right name for consistency even it's not called right now.
test/functional/tool_bitcoin.py
Outdated
assert_equal(err, b"") | ||
|
||
def run_test(self): | ||
self.log.info("Ensure bitcoin command invokes bitcoind by default") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bitcoin node
command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f325839
to
b0e9637
Compare
da1ef87
to
9ebbbcb
Compare
3b3c925
to
0e189dc
Compare
RuntimeError: Unexpected output from ['D:\\a\\bitcoin\\bitcoin\\bin\\bitcoin.exe', 'node', '-datadir=D:\\a\\_temp\\test_runner_₿_🏃_20250904_040915\\tool_bitcoin_29\\node0', '-logtimemicros', '-debug', '-debugexclude=libevent', '-debugexclude=leveldb', '-debugexclude=rand', '-uacomment=testnode0', '-disablewallet', '-logthreadnames', '-logsourcelocations', '-loglevel=trace', '-nologratelimit', '-v2transport=0', '-version']: out=b'' err=b'Assertion failed: base.is_absolute(), file ./util/fs.cpp, line 38\r\n' ret=3 Windows native, VS 2022 https://github.com/bitcoin/bitcoin/actions/runs/17452836196/job/49560783679?pr=33229 Windows, test cross-built https://github.com/bitcoin/bitcoin/actions/runs/17452836196/job/49561115662?pr=33229
0e189dc
to
f3faaa0
Compare
gmake: *** No rule to make target 'deploy'. Stop. https://github.com/bitcoin/bitcoin/actions/runs/17464984349/job/49598412758?pr=33229 https://github.com/bitcoin/bitcoin/actions/runs/17464984349/job/49598400710?pr=33229 AssertionError: Unexpected stderr @@@@
@@@@ Cached path '' @@@@ Not directory path 'D:\a\_temp\test_runner_?_??_20250904_143739\tool_bitcoin_0\node0' Assertion failed: base.is_absolute(), file D:\a\bitcoin\bitcoin\src\util\fs.cpp, line 38 https://github.com/bitcoin/bitcoin/actions/runs/17466846483/job/49604704419?pr=33229 also try to fix linux cross>windows build error No target "bitcoin-qt" https://github.com/bitcoin/bitcoin/actions/runs/17466846483/job/49604716292?pr=33229
unicode now working https://github.com/bitcoin/bitcoin/actions/runs/17468061915/job/49608942805?pr=33229 /bin/makensis -V2 /home/admin/actions-runner/_work/_temp/build/bitcoin-win64-setup.nsi File: "/home/admin/actions-runner/_work/_temp/build/release/bitcoin-qt.exe" -> no files found. Usage: File [/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] | /oname=outfile one_file_only) Error in script "/home/admin/actions-runner/_work/_temp/build/bitcoin-win64-setup.nsi" on line 75 -- aborting creation process gmake[3]: *** [CMakeFiles/deploy.dir/build.make:81: bitcoin-win64-setup.exe] Error 1 gmake[3]: Leaving directory '/home/admin/actions-runner/_work/_temp/build' https://github.com/bitcoin/bitcoin/actions/runs/17468061915/job/49608953626?pr=33229
…ctly still empty output native build https://github.com/bitcoin/bitcoin/actions/runs/17470812198/job/49618470699?pr=33229 still skipped test cross build https://github.com/bitcoin/bitcoin/actions/runs/17470812198/job/49619359209?pr=33229
still empty output native build https://github.com/bitcoin/bitcoin/actions/runs/17471664334/job/49621358922?pr=33229 still skipped test cross build https://github.com/bitcoin/bitcoin/actions/runs/17471664334/job/49622036064?pr=33229
@@ -446,7 +446,7 @@ def is_node_stopped(self, *, expected_stderr="", expected_ret_code=0): | |||
self.stderr.seek(0) | |||
stderr = self.stderr.read().decode('utf-8').strip() | |||
if stderr != expected_stderr: | |||
raise AssertionError("Unexpected stderr {} != {}".format(stderr, expected_stderr)) | |||
print("Unexpected stderr {} != {}".format(stderr, expected_stderr)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No access to self.logger
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No access to
self.logger
here?
Yeah sorry, this is just a workaround for debugging. This test is just not working on windows and I was trying to debug it using CI to avoid needing to setup a windows build and vm and see if the issue happens there.
So far I've fixed one issue where unicode path CI uses was not properly handled by bitcoin
wrapper on windows, but there is another issue where stdout/stderr process of the bitcoind
do not seem to be captured by python when it is invoked through bitcoin node
. Have more things I want to try to debug this and some ideas for fixing this, so will continue to use this PR to debug a little while, but if it doesn't work out I'll just disable the new test on windows.
try writing to file and changing return code no output from wrapped bitcoind https://github.com/bitcoin/bitcoin/actions/runs/17473672184/job/49628086738?pr=33229 https://github.com/bitcoin/bitcoin/actions/runs/17473672184/job/49628785697?pr=33229
sipa and theuni in #31802 pointed out that users shouldn't be exposed to multiprocess implementation details just to use IPC features, so current need to specify the
bitcoin -m
option in conjunction with-ipcbind
could be seen as a design mistake and not just a usage inconvenience. This is easy to fix by having thebitcoin
wrapper respect IPC settings. Was planning to do this anyway, but this provides a good excuse to do it now.