4 suggestions
Earlier concerns neither republished nor resolved: 3 suggestions. See the Run archive for their assessments.
Optional improvements
[suggestion] · Failure cleanup can destroy a template still used by submitSolution()
Source inspection shows that timeout or exception cleanup can destroy the template while the writer RPC still uses it; no failing teardown interleaving was observed.
Location: test/functional/interface_ipc_mining.py:923 (head).
Details and suggested fix
Cancelling and gathering the Python tasks ends their client-side awaits, not necessarily the server-side calls. In libmultiprocess, cancellation of an executing request sets request_canceled, which ServerCall checks after the implementation returns. Meanwhile, stack.aclose() sends destroy() through reader_ctx, and invokeDestroy() immediately resets m_impl while the writer worker may still execute submitSolution(). The retained thisCap() reference protects the proxy, not the explicitly destroyed implementation. The copied block narrows the hazardous window to template access before validation, but destroying m_block_template or m_mutex during that window can cause a use-after-free or sanitizer report that obscures the original test failure. Normal completion is unaffected because every RPC finishes before cleanup.
Retain and shield the in-flight RPC promises from task cancellation, then drain them before sending destroy().
[suggestion] · The getTotalFees() contract leaves base-fee semantics implicit
Clients must infer whether getTotalFees() reports actual fees or the modified mining score, and which total waitNext() compares.
Location: src/interfaces/mining.h:50 (head).
Details and suggested fix
getTotalFees() returns nFees, accumulated from the same entry.GetFee() values as getTxFees(). It excludes both the block subsidy and prioritisetransaction deltas, and waitNext() measures fee_threshold against this total. The prioritised-mining test already asserts the base-fee result of 2,000 satoshis, but the public comment says only “Total transaction fees in satoshis.” Document it as the sum of actual fees paid by the non-coinbase transactions, explicitly state those exclusions and its relationship to waitNext(), and mirror the fee definition in the m_total_fees comment in src/node/miner.h.
[suggestion] · Tests do not check template access during waitNext()
The implementation releases m_mutex before waiting, but the tests do not check that another worker can still access the same template during waitNext().
Location: src/node/interfaces.cpp:946 (head).
Details and suggested fix
Holding m_mutex across WaitAndCreateNewBlock() would delay getters and solution submission until the wait ends, without necessarily introducing a data race. The existing interrupt test would still pass because interruptWait() uses only m_tip_block_mutex, and the new concurrency fixture never calls waitNext(). Reuse the two-context setup to start a long wait with feeThreshold=MAX_MONEY, establish that it is waiting, and require getBlockHeader() on the other context to finish within a short bound before interrupting the wait. Keep the tip recent so regtest's 20-minute refresh cannot end the wait early, and await the wait's completion before destroying the template.
[suggestion] · The race-fix series depends on the optional getTotalFees @11 method
If #36515 needs a backport, the current sequence ties its mutex fix to a new IPC method even though the fix needs only internal template state.
Location: src/node/interfaces.cpp:932 at 38db9f9c38a9 (commit) (commit).
Details and suggested fix
waitNext() now calls the public getTotalFees(), tying the subsequent mutex fix to the getter and its schema addition. A schema-free fix prefix would be easier to validate or backport independently. Consider rewriting the order as fee storage (4ed58734eb0fec65dff236bbf687502099aeb2e3), snapshot-argument refactor (38db9f9c38a9db6ee64f87e2b20052293eba4f83), mutex fix (8ed9e3d90bcfc2a1675ddfdab1a6053e435f2f66), concurrency test (9c85ea058179631666038b33c6b5c9ab44c4213b), then the public getter, schema entry and assertions (c2a3d430bc1867611a5055f5d64140fe1865b70b).
The refactor would capture hashPrevBlock and m_total_fees directly into locals. Once the mutex is introduced, take that snapshot under a scoped lock and release it before waiting. The later getter commit would add its own locked accessor. This preserves behavior but requires rewriting, not just reordering commits. The existing sequence checks fee semantics earlier, and the description already offers a separate direct fix if this PR stalls; this suggestion matters if an independent backport is wanted, not because the final tree is defective.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [suggestion]: Add a release note for the new mining IPC method
- [suggestion]: Exercise the merkle-path getter during concurrent submissions
- [suggestion]: Concurrent-access test can leave a headers-only best header (earlier report)
Background
Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.
Documented decisions
Mutation was consciously adopted as a way for clients to retrieve the reconstructed submission through getBlock(), avoiding a separate applySolution() API.
The #33374 proposal explained that IPC clients may lack the information needed to reconstruct a submitted block, making invalid-block debugging difficult; obtaining the reconstructed block could also support alternative broadcasting. Ryan Ofsky asked why a new method was needed when submitSolution() already modified the block and getBlock() already existed. Sjors explicitly agreed to embrace that mutation and extract documentation and tests. This is the strongest inspected explanation for preserving an observable mutation rather than changing only a submission-local copy.
Source 1 · Source 2 · Source 3
Unresolved disagreements
Historical follow-up raised a competing copy-before-applying design, but the inspected record does not show its complete resolution.
In #33745, a participant noted that documenting mutation conflicted with #33421's proposed template cache, which would apply solutions to a copy. A reply favored updating #33421 to preserve mutation. This shows that copying versus retaining observable mutation was an explicit API tradeoff, not a protocol necessity; the unavailable linked discussion prevents a fuller account of the resolution.