Add bitcoin node + IPC to test harness #602

Merged
paratoxic merged 10 commits from bitcoin-node-ipc into master 2026-08-20 16:07:41 +00:00
Owner
No description provided.
Add bitcoin node + IPC to test harness
Some checks failed
CI / ckpool (pull_request) Successful in 24s
CI / test-linux (pull_request) Has been cancelled
CI / lint (pull_request) Has been cancelled
7152a63881
Solidify
Some checks failed
CI / ckpool (pull_request) Successful in 12s
CI / lint (pull_request) Successful in 2m28s
CI / test-linux (pull_request) Failing after 7m17s
95115ed9c8
Relevel
All checks were successful
CI / ckpool (pull_request) Successful in 12s
CI / lint (pull_request) Successful in 2m16s
CI / test-linux (pull_request) Successful in 8m1s
1af5a27892
Solidify
All checks were successful
CI / ckpool (pull_request) Successful in 41s
CI / lint (pull_request) Successful in 3m14s
CI / test-linux (pull_request) Successful in 8m44s
8f373e5d00
Change
All checks were successful
CI / ckpool (pull_request) Successful in 15s
CI / lint (pull_request) Successful in 2m5s
CI / test-linux (pull_request) Successful in 8m47s
62d3c5f278
Improve
Some checks failed
CI / ckpool (pull_request) Successful in 26s
CI / lint (pull_request) Successful in 2m14s
CI / test-linux (pull_request) Failing after 6m41s
21f0a8f9d5
parabit left a comment

CI never installs capnproto, this results in the IPC path being compiled out.
The test-linux job (.github/workflows/ci.yaml:40-61) runs only ./bin/install-bitcoin-core-linux (the "Install bitcoind" step) then cargo test --all. Neither just install nor bin/install-capnproto-linux runs, and ubuntu-latest ships no libcapnp-dev.
HAVE_CAPNP=false means all code related to IPC is gutted from ckpool at compile time.

CI never installs capnproto, this results in the IPC path being compiled out. The test-linux job (.github/workflows/ci.yaml:40-61) runs only ./bin/install-bitcoin-core-linux (the "Install bitcoind" step) then `cargo test --all`. Neither `just install` nor bin/install-capnproto-linux runs, and ubuntu-latest ships no libcapnp-dev. `HAVE_CAPNP=false` means all code related to IPC is gutted from ckpool at compile time.
@ -26,1 +25,4 @@
# /usr/local/libexec is root-owned on GitHub Actions runners, so expose
# bitcoin-node on PATH like bitcoind instead of installing into libexec.
rm -f /usr/local/bin/bitcoin-node
Owner

You also should attempt (ignoring failure or gating on file existence/access before attempting)
rm -f /usr/local/libexec/bitcoin-node

Failing to include this will leave the old copy on any machine that has previously executed this script and because of how it prioritizes libexec it will leave an outdated copy on future version bumps.

You also should attempt (ignoring failure or gating on file existence/access before attempting) `rm -f /usr/local/libexec/bitcoin-node` Failing to include this will leave the old copy on any machine that has previously executed this script and because of how it prioritizes libexec it will leave an outdated copy on future version bumps.
@ -382,0 +391,4 @@
* single miner signet can sit in IBD forever by design and producing
* templates there is the whole point. Mirrors the getblocktemplate
* RPC, which rejects in IBD only when !isTestChain. */
bool ready() const { return have_mining_.load() && (!ibd_.load() || is_test_chain_); }
Owner

This will cause it to fail over from IPC to RPC with infinite retries, no backoff, and only stopping when IBD is complete.

See stratifier.c:2063-2069 for the offending loop. This is due to IPC dispatching tip updates during IBD and results in ipcnotify triggering a workbase update.

Additionally this modification will cause Sv2 to report that template declarations are not allowed (persisting until IBD is complete or as long as Sv2 clients rely on the last reported configuration). This is lower priority than the above as it only impacts Sv2 which we do not use currently.

This will cause it to fail over from IPC to RPC with infinite retries, no backoff, and only stopping when IBD is complete. See `stratifier.c:2063-2069` for the offending loop. This is due to IPC dispatching tip updates during IBD and results in ipcnotify triggering a workbase update. Additionally this modification will cause Sv2 to report that template declarations are not allowed (persisting until IBD is complete or as long as Sv2 clients rely on the last reported configuration). This is lower priority than the above as it only impacts Sv2 which we do not use currently.
@ -480,2 +493,3 @@
* unwinds to the reconnect path below. */
* unwinds to the reconnect path below. The result is
* the IBD state ready() gates on. */
auto probe = mining_.isInitialBlockDownloadRequest();
Owner

mining_ipc.cpp:495-497 and mining_ipc.cpp:559-561 are identical and can be abstracted to a private refresh_ibd(kj::WaitScope&) helper.

`mining_ipc.cpp:495-497` and `mining_ipc.cpp:559-561` are identical and can be abstracted to a private `refresh_ibd(kj::WaitScope&)` helper.
@ -544,1 +561,3 @@
probe.send().wait(ws);
ibd_.store(probe.send().wait(ws).getResult());
{
Owner

What do these braces accomplish? It appears to be ineffectual in this context?

What do these braces accomplish? It appears to be ineffectual in this context?
@ -598,0 +621,4 @@
std::atomic<bool> ibd_{false};
/* Written on the service thread before have_mining_ publishes the
* connection, so plain bool is sufficient. */
bool is_test_chain_{false};
Owner

Comment is only true for initial publication which is latched. On a bitcoind restart, the keepalive loop catches the disconnect (clearing have_mining_ around line 501), then on its next pass calls obtain_mining(ws, init) at mining_ipc.cpp:488. obtain_mining (mining_ipc.cpp:549) rewrites is_test_chain_ at line 566, then re-publishes with have_mining_.store(true) at line 570.

This creates a race condition that can misreport is_test_chain_ as false. Recommend using std::atomic<bool> as the above variables do.

Comment is only true for initial publication which is latched. On a bitcoind restart, the keepalive loop catches the disconnect (clearing `have_mining_` around line 501), then on its next pass calls `obtain_mining(ws, init)` at `mining_ipc.cpp:488`. `obtai`n_mining (mining_ipc.cpp:549) rewrites `is_test_chain_` at line 566, then re-publishes with `have_mining_.store(true)` at line 570. This creates a race condition that can misreport `is_test_chain_` as false. Recommend using `std::atomic<bool>` as the above variables do.
@ -623,0 +652,4 @@
* regtest and single miner signets that wait never ends (upstream
* says as much), and ckpool wants a template regardless, so opt
* out. */
req.setCooldown(false);
Owner

This bypasses a reorg protection that is less important on regtest/signet, but very important to retain for mainnet.

I would recommend setCooldown(!is_test_chain_) instead.

This bypasses a reorg protection that is less important on regtest/signet, but very important to retain for mainnet. I would recommend `setCooldown(!is_test_chain_)` instead.
@ -29,5 +29,6 @@
"startdiff" : 1,
"maxdiff" : 0,
"zmqblock" : "tcp://127.0.0.1:28332",
"ipcmining" : "copr/signet/node.sock",
Owner

The local testing setup should probably explicitly specify the same path for ipcbind/ipcmining. As this assumes some things about the current working directory.

The local testing setup should probably explicitly specify the same path for ipcbind/ipcmining. As this assumes some things about the current working directory.
@ -304,0 +307,4 @@
let subdir = match self.network {
Network::Signet => "signet",
Network::Regtest => "regtest",
_ => return None,
Owner

The Option returned here is a bit ambigous and while it can be None for both a unsupported network OR a missing datadir, it is only ever reported in test_ckpool.rs as the latter.

We can dodge this function completely by just including a static path in our ipcbind for the harness.
ipcbind=unix:/absolute/path

The Option returned here is a bit ambigous and while it can be None for both a unsupported network OR a missing datadir, it is only ever reported in test_ckpool.rs as the latter. We can dodge this function completely by just including a static path in our ipcbind for the harness. `ipcbind=unix:/absolute/path`
Improve
All checks were successful
CI / ckpool (pull_request) Successful in 16s
CI / lint (pull_request) Successful in 1m50s
CI / test-linux (pull_request) Successful in 5m49s
d81a6063c0
Solidify
All checks were successful
CI / ckpool (pull_request) Successful in 17s
CI / lint (pull_request) Successful in 1m48s
CI / test-linux (pull_request) Successful in 5m51s
1e20269887
Improve
All checks were successful
CI / ckpool (pull_request) Successful in 16s
CI / lint (pull_request) Successful in 1m44s
CI / test-linux (pull_request) Successful in 5m32s
3dbc24f4ce
Tweak
All checks were successful
CI / ckpool (pull_request) Successful in 7s
CI / lint (pull_request) Successful in 1m22s
CI / test-linux (pull_request) Successful in 5m0s
3b46e0dcc7
paratoxic merged commit 8d0509cdb7 into master 2026-08-20 16:07:41 +00:00
paratoxic deleted branch bitcoin-node-ipc 2026-08-20 16:07:42 +00:00
Sign in to join this conversation.
No description provided.