4 suggestions
Optional improvements
[suggestion] · Mining IPC migration lacks a release note
The mining IPC changes require client code updates, but no release note explains the migration; unchanged clients receive explicit errors rather than silently using changed wire semantics.
Location: src/ipc/capnp/mining.capnp:51 (head).
Details and suggested fix
Add a uniquely named doc/release-notes-<PR>.md entry with an IPC Interface section, following the API-change guidance in doc/developer-notes.md. Map getBlockHeader(), getBlock() and getCoinbaseMerklePath() to block().header(), block().data() and block().coinbaseMerklePath(), and explain that the retired ordinals return update errors. Clients must regenerate bindings and change both submission calls to read acceptance from accepted and obtain the submitted or rejected block from the returned Block handle. In particular, submitSolution() no longer changes the template, so a partial migration that still reads template.block().data() afterward gets the original template, not the solved block. Also document that a null C++ coinbase or empty IPC coinbase data now raises an error instead of returning false.
[suggestion] · Concurrency test can leave the best header ahead of the tip
The concurrency test can leave a best header above the tip, delaying later default-cooldown template requests; the next test currently supersedes it by mining blocks.
Location: test/functional/interface_ipc_mining.py:941 (head).
Details and suggested fix
For any iteration whose header passes proof of work, AcceptBlock() indexes the header before ContextualCheckBlock() rejects the witness-stripped coinbase as BLOCK_MUTATED with bad-witness-nonce-size. That rejection leaves the header valid, so the unchanged getblockcount() assertion does not detect that BlocksAheadOfTip() can now return 1. A subsequent createNewBlock() with the default cooldown would wait three seconds. The current ordering avoids that delay because run_unsatisfiable_timestamp_test() first mines six blocks; this is an isolation issue established from source, not an observed test failure.
For each iteration, compute the candidate merkle root locally and choose a nonce that fails proof of work, then assert the high-hash rejection. This still exercises the template copy and header updates concurrently with the readers, but rejects before adding anything to the block index.
[suggestion] · Four newly retired IPC stubs lack error-path coverage
The IPC test checks only getBlockOld2; four other newly retired methods could stop throwing update errors without any assertion failing.
Location: test/functional/interface_ipc_mining.py:536 (head).
Details and suggested fix
getBlockHeaderOld1, getCoinbaseMerklePathOld6, submitSolutionOld10 and Mining.submitBlockOld7 are not called by any test. The unit check for submitSolutionOld7 covers an older stub, not one retired here. Add assert_capnp_raises checks alongside getBlockOld2, using the existing context and serialized block and coinbase, to verify that each method returns its expected update error rather than succeeding. These current-schema calls would cover runtime failure behavior and message text; they would not independently detect a consistent reassignment of historical ordinal numbers.
[suggestion] · Failure cleanup can destroy a template during submitSolution()
After test failure or timeout, destroy(reader_ctx) can free the template while a cancelled submission still runs on the writer; passing runs are unaffected, and source inspection establishes the race rather than an observed crash.
Location: test/functional/interface_ipc_mining.py:948 (head).
Details and suggested fix
Cancelling and gathering the Python tasks waits for client-side cancellation, not completion of an already running C++ call. Libmultiprocess checks request_canceled after method invocation, and its thisCap() reference retains the ProxyServer, not the implementation reset by invokeDestroy(). Cleanup sends destroy(reader_ctx) on a different worker from the submission. In the narrow interval between dispatch and entering SubmitBlock(), submitSolution() still reads m_block_template and m_node, so destruction can cause a use-after-free and add crash or sanitizer noise to the original failure's chained traceback.
Before stack.aclose(), await a bounded completion barrier on writer_ctx, such as a cheap template getter. If the barrier fails or times out, skip the explicit destroy() and drop the capability instead, allowing the server-held reference to defer cleanup until the call finishes.
Background
Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.
Documented decisions
For externally used mining IPC, the stated compatibility objective was to prevent silent wire incompatibility, not to preserve every method indefinitely. Ryan Ofsky distinguished explicit errors from mismatches that call a different method or interpret arguments incorrectly, and advocated explicit failures even on master to make outdated clients obvious and avoid debugging headaches.
The affected methods are external mining IPC entry points. Retaining their original ordinals as error-returning methods addresses precisely the historical concern: an older client should encounter an identifiable incompatibility rather than accidentally invoke a replacement with different argument or result semantics.
Compatible evolution was preferred where straightforward, but intentional client cutoffs were contemplated and implemented. The earlier #34568 proposal explicitly disabled the old makeMining entry point because older clients were less stable and performant, while enabling schema improvements awkward to implement compatibly. In that discussion, Ofsky described the desired cross-revision property as calls either succeeding or failing, but never exchanging corrupt parameters or return values.
This history does not promise continued successful operation for all old mining clients. It supports a migration model in which clients sometimes must update their schema, while incompatibility remains detectable. It also prevents treating explicit-error stubs as a promise to emulate the retired implementation.