Mining

PRPriorityReviewabilityReviewsAgreementSize
(+)#36525 Sjors mining: add getTotalFees(), protect m_block_template with mutexP1 · bug fixReady3Strong69 + 61 tests
  • Prevent data races when concurrent IPC worker threads submit solutions while reading active block templates
  • Allow external mining clients to fetch total template fees directly instead of summing individual fees
  • P1 after comparing with the other PRs here (assessed alone as P2): Raised to P1: the only PR fixing a concrete reported data race (#36515) in the interface external miners already use; leaving it at P2 with the feature PRs would flatten a correctness bug into the same level as enhancements.
  • P2 because it fixes a data race when concurrent IPC worker threads access templates during block submission
  • Improves stability and completeness of the mining interface relied on by external Stratum v2 clients
  • Ready for review
  • Substantive support for resolving the race condition and adding the fee query (ismaelsadeeq, enirox001)
  • Verified the race fix with a concurrent template access test under ThreadSanitizer (enirox001)
  • Suggested making templates immutable instead of locking, deferred due to IPC latency benchmarks (sedited)
  • Concept and code approval without detailed comments (w0xlt)
  • 69 lines added or modified outside tests
  • 61 lines added or modified in tests
  • 33 lines removed in total
  • 9 files, 5 commits
(+)#35581 ismaelsadeeq node: add block template manager and track waitNext fee inflowP2 · speedupNeeds rebase0Strong752 + 1,416 tests
  • Avoid rebuilding full block templates repeatedly just to check if mempool fee increases warrant a new one
  • Reduce CPU overhead and lock contention for miners waiting on template updates
  • P2 because it stops full block assembly and lock acquisition on every tick during template polling
  • Significantly cuts CPU usage and lock contention for miners waiting on template updates
  • Ranking pass: Root of the BlockTemplateManager chain (#33922, #36356, #36357 build on it) as well as a measurable CPU/lock-contention win for template polling.
  • Worth reviewing now despite conflict with master, as the needed rebase is mechanical
  • Strong support with no blocking objections
  • Supports incremental tracking over full rebuilds and notes fuzz test found a real bug (pablomartin4btc)
  • Concept approval without stated reasons (w0xlt)
  • Open suggestion to restore and update a miner comment on staleness checks (pablomartin4btc)
  • 752 lines added or modified outside tests
  • 1,416 lines added or modified in tests
  • 587 lines removed in total
  • 51 files, 27 commits
(+)#35671 Sjors mining: add TxCollection to bandwidth-efficiently validate external block templatesP2 · new featureReady0Strong491 + 447 tests
  • Let external mining coordinators validate block templates without keeping duplicate mempools
  • Reduces memory and bandwidth overhead for tools like Stratum v2 Job Declarator Servers
  • P2 because it lets mining coordinators reconstruct and validate block templates efficiently
  • Removes the need for external tools to maintain out-of-process mempool mirrors
  • Directly unblocks Stratum v2 reference tooling integration
  • Ready for review
  • Substantive support with no open objections
  • Strong support because it avoids duplicate storage and continuous mirror sync (enirox001)
  • Verified by running the new tests and the mining test suite (jeanpablojp)
  • Concept approval without stated reasons (ismaelsadeeq, pablomartin4btc)
  • 491 lines added or modified outside tests
  • 447 lines added or modified in tests
  • 58 lines removed in total
  • 17 files, 7 commits
(+)#33922 Sjors mining: add getMemoryLoad() and track template non-mempool memory footprintP2 · new featureReady0 (+3)Strong152 + 26 tests
  • Let node operators and IPC mining clients inspect memory pinned by active block templates
  • Help prevent unmonitored memory usage when evicted mempool transactions remain in templates
  • P2 because IPC mining clients currently lack visibility into memory held by retained block templates
  • Unblocks template memory management needed by external Stratum v2 template providers
  • Ready for review
  • Strong support with all earlier objections resolved
  • Concept approval because it provides tracking needed to limit template memory (ryanofsky)
  • Verified by running with a Stratum v2 template provider on mainnet for 20 hours (xyzconstant)
  • Code review approval verifying template reference locking and lifetime handling (enirox001)
  • 152 lines added or modified outside tests
  • 26 lines added or modified in tests
  • 14 lines removed in total
  • 9 files, 4 commits
(+)#35300 w0xlt mining: add precious option to IPC block submissionP2 · new featureWaiting on author0Strong163 + 488 tests
  • Allow external mining clients to submit and prioritize a mined block over competing tips in one IPC call
  • Eliminate round trips and race conditions with concurrent chain activations from separate RPC calls
  • P2 because it allows IPC miners to atomically prioritize their own blocks over competing equal-work tips
  • Removes round-trip latency and prevents race conditions with concurrent chain activations
  • Worth reviewing now because the logic is ready
  • Needs a mechanical rebase due to conflicts with master
  • Broad support for letting miners atomically prioritize their own blocks (Sjors, pablomartin4btc, enirox001)
  • Concept support noting that preferring own tips rationally maximizes mining rewards (johnnyasantoss, 0xB10C)
  • Unanswered question asks if downstream client demand justifies IPC compatibility costs (enirox001)
  • Unaddressed suggestion to combine duplicate inconclusive-result checks (enirox001)
  • 163 lines added or modified outside tests
  • 488 lines added or modified in tests
  • 101 lines removed in total
  • 19 files, 7 commits
(+)#36047 chriszeng1010 rpc: handle createNewBlock() returning nullptr during shutdownP3 · bug fixAuthor silent 73d0Crickets6 + 34 tests
  • Prevent false internal bug assertions when mining RPCs run during node shutdown
  • Return a standard shutdown error to mining RPC clients instead of an assertion failure
  • P3 because benign shutdown during mining calls triggers false internal bug assertions
  • Affects miners using getblocktemplate or longpolling while stopping the node
  • Ranking pass: Moved up: it is the only fix for a user-reported failure (#34262) miners hit in normal operation, so it leads the P3 block ahead of tooling and refactors.
  • Ready to review
  • No review verdicts recorded
  • No reviews or discussion yet
  • No substantive feedback either way
  • 6 lines added or modified outside tests
  • 34 lines added or modified in tests
  • 4 lines removed in total
  • 2 files, 1 commits
(+)#36367 Bruce039 mempool: keep prioritisetransaction deltas within MAX_MONEYP3 · bug fixReady0Crickets11 + 29 tests
  • Prevent cluster mempool integer overflows when aggregating prioritised transaction fee deltas
  • Avoid negative chunk fees that cause getblocktemplate to omit prioritised transactions
  • P3 because it stops template generation from dropping prioritised transactions due to corrupted chunk fees
  • Impact is limited because triggering it requires unrealistic fee deltas far exceeding MAX_MONEY
  • Ranking pass: Moved up: signed-overflow UB that silently drops prioritised transactions from templates is a template-correctness issue, ranking above cleanups and tests despite the unrealistic trigger.
  • Ready for review
  • No obstacles or pending changes known that would invalidate review
  • No review verdicts recorded
  • No substantive comments or reviews yet
  • Awaiting initial review
  • 11 lines added or modified outside tests
  • 29 lines added or modified in tests
  • 3 lines removed in total
  • 3 files, 1 commits
(+)#36356 w0xlt mining: move getblocktemplate cache into BlockTemplateManagerP3 · cleanupReady0Strong71 + 66 tests
  • Tie mining template cache lifetimes to the node context rather than process-scoped static state
  • Prevent cached block pointers from outliving chainstate managers and enable template invalidation unit tests
  • P3 because it is an internal cleanup removing static global state from mining RPCs
  • Prevents lifetime issues in tests and enforces compile-time thread-safety annotations
  • Adds direct unit testing for template invalidation without altering mining behavior
  • Ranking pass: Moved up: it is the declared base of #36357, so reviewing it first is what makes the user-visible getmininginfo fix mergeable.
  • Ready for review
  • Substantive support with no open objections (ismaelsadeeq, Sjors)
  • Concept approval for facilitating future shared caching across RPC and IPC mining (ismaelsadeeq)
  • Support for keeping the scope simple and focused via a three-commit split (Sjors)
  • Author addressed questions on cache lifetime and parameterization (ismaelsadeeq)
  • 71 lines added or modified outside tests
  • 66 lines added or modified in tests
  • 32 lines removed in total
  • 4 files, 3 commits
(+)#36357 w0xlt mining: move BlockAssembler statics into BlockTemplateManagerP3 · bug fixWaiting on author0Strong110 + 91 tests
  • Ensure getmininginfo reports actual mining templates rather than fee estimator templates
  • Eliminate thread-unsafe global state for block weight and transaction counts
  • P3 because it fixes inaccurate template statistics reported by getmininginfo during fee estimation
  • Eliminates global static variables to improve thread safety and multi-node isolation
  • Concept approval for consolidating template caching in BlockTemplateManager (ismaelsadeeq)
  • Open suggestion to also move the block template cache into BlockTemplateManager (ismaelsadeeq)
  • 110 lines added or modified outside tests
  • 91 lines added or modified in tests
  • 44 lines removed in total
  • 5 files, 3 commits
(+)#36097 xyzconstant mining: replace interrupt methods with cancellation argumentsP3 · cleanupCI failing0Strong2,133 + 43 tests
  • Simplify canceling in-flight blocking mining requests over IPC
  • Eliminate extra round-trips and awkward out-of-band interrupt coordination for mining clients
  • P3 because it improves interface ergonomics and avoids round-trips for callers like Stratum v2
  • Working interrupt mechanisms already exist, making this cleanup reasonably deferrable
  • CI is failing; check whether the failure is from this PR before deep review
  • No review verdicts recorded
  • Substantive support with no open objections
  • Direct cancellation simplifies both clients and servers over issuing separate interrupt calls (ryanofsky)
  • 2,133 lines added or modified outside tests
  • 43 lines added or modified in tests
  • 616 lines removed in total
  • 70 files, 2 commits
(+)#30437 ryanofsky ipc: add bitcoin-mine test programP3 · test coverageWaiting on author0 (+3)Blocked219 + 41 tests
  • Provide an end-to-end test executable to exercise and validate IPC mining outside the node process
  • Help multiprocess Bitcoin Core development and external mining implementations like Stratum v2
  • P3 because it adds developer tooling and functional test coverage for block template mining
  • Useful for downstream Stratum v2 integrations but ranks behind core consensus mining logic
  • Ranking pass: Moved down: developer-facing tooling ranks last in this category's ordering, below the behavioural fixes it now sits behind.
  • Reviewable immediately as nothing known invalidates review now
  • Unaddressed objection: potential crash if block creation returns null during shutdown (w0xlt)
  • Unaddressed objection: argument parsing bugs wrap negative or clamp low maxtries values (w0xlt)
  • Objection answered: avoid shipping experimental binary in releases via dedicated build option (sedited, fanquake)
  • Verified by testing standalone binary and functional tests on macOS (Sjors, BrandonOdiwuor)
  • Concept approval as a usage example for mining interfaces (ismaelsadeeq)
  • 219 lines added or modified outside tests
  • 41 lines added or modified in tests
  • 7 lines removed in total
  • 10 files, 5 commits
(+)#32468 polespinasa rpc: generateblock to allow multiple outputsP3 · new featureReady0Strong131 + 134 tests
  • Allow developers to test blocks with multiple coinbase recipients and custom payout splits
  • Enable mining mempool transactions automatically in regtest without crafting raw blocks
  • P3 because it improves developer tooling for simulating mining-pool coinbase payouts
  • Eliminates the need to construct raw blocks manually when testing regtest mining structures
  • Ready for review following an author rebase
  • No review verdicts recorded
  • Strong support for simulating protocols with multiple coinbase recipients (supertestnet)
  • Addressed objections against creating a separate RPC and modifying core miner logic (andrewtoth, maflcko)
  • Addressed objections on backwards compatibility and custom reward amounts (achow101, stickies-v)
  • 131 lines added or modified outside tests
  • 134 lines added or modified in tests
  • 55 lines removed in total
  • 15 files, 7 commits
(+)#36192 Sjors test: cover unsatisfiable mining timestampP3 · test coverageNeeds rebase2Strong0 + 124 tests
  • Test that block template creation fails cleanly when median time past reaches the future-time limit
  • Verify template creation recovers one second later and keeps mining IPC connections alive
  • P3 because it tests template creation failure and recovery under extreme timestamp constraints
  • Adds test coverage for an edge case that was previously untested and infeasible on mainnet
  • Ready for review
  • Strong support with no open objections (fjahr, ismaelsadeeq)
  • Nonblocking suggestions on test location and runtime were dropped (fjahr, ismaelsadeeq)
  • 0 lines added or modified outside tests
  • 124 lines added or modified in tests
  • 29 lines removed in total
  • 6 files, 5 commits
(+)#35598 Sjors test: cover feeThreshold = MAX_MONEY in interface_ipc_mining.pyP3 · test coverageReady0 (+1)Strong0 + 26 tests
  • Prevent regressions when mining IPC clients ignore mempool fee increases and wait only for new blocks
  • P3 because it only adds functional test coverage for an existing mining IPC interface option
  • Validates that template recreation is skipped until a tip update without altering node logic
  • Ready to review
  • Substantive support for adding dedicated test coverage (enirox001)
  • Concept approval without detailed review (jeanpablojp)
  • Past test timing issues and assertion suggestions addressed (davidgumberg, jeanpablojp, enirox001)
  • 0 lines added or modified outside tests
  • 26 lines added or modified in tests
  • 12 lines removed in total
  • 2 files, 1 commits
(+)#36156 l0rinc mining: include chunks that reach block limitsP3 · bug fixReady0Mild16 + 16 tests
  • Allow block templates to include transactions that bring block weight or sigops exactly to limits
  • Prevents leaving valid block capacity unused and dropping transactions that fit consensus boundaries
  • P3 because the fee upside from fitting an extra transaction at exact limit boundaries is tiny
  • Aligning template building with consensus limits is correct but brings marginal real-world benefit
  • Reviewing now is worthwhile
  • Nothing known that would invalidate a review
  • Concept approval to match consensus limits so pools do not need to patch templates themselves (ismaelsadeeq)
  • Objection: off-by-one errors risk producing invalid blocks and losing the reward for tiny fee gains (ajtowns)
  • Author added boundary tests and clarified miner budget docs, awaiting objector follow-up
  • 16 lines added or modified outside tests
  • 16 lines added or modified in tests
  • 15 lines removed in total
  • 5 files, 5 commits
(+)#36132 l0rinc mining: preserve lookup result count without a mempoolP4 · bug fixReady1Strong2 + 16 tests
  • Keep mining transaction lookups consistent with caller expectations when no mempool is loaded
  • Ensure callers can safely index results by position without special-casing an empty mempool
  • P4 after comparing with the other PRs here (assessed alone as P3): Lowered to P4: reviewers confirm the no-mempool lookup path is unreachable in production, making it a contract-consistency tidy-up on par with #36451 rather than a real bug fix.
  • P3 because callers relying on positional indexing get consistent results without a mempool
  • The benefit is minor since current production paths do not encounter lookups without a mempool
  • Ready to review
  • Substantive support for preserving caller indexing expectations without a mempool
  • Verified by running tests and checking that reverting the fix causes failures (jeanpablojp)
  • Prefers returning empty entries over throwing errors when no mempool is loaded (Sjors)
  • Agrees it preserves documented contracts better than returning an empty list (enirox001)
  • 2 lines added or modified outside tests
  • 16 lines added or modified in tests
  • 2 lines removed in total
  • 2 files, 2 commits
(+)#36451 maflcko refactor: Use NotNull for CreateNewBlock and pimplsP4 · cleanupCI failing0Strong30 + 13 tests
  • Clarify pointer contracts by enforcing non-null semantics for block creation and internal implementations
  • Eliminate confusing null checks and dead error-handling branches in tests and callers
  • P4 because internal typing improvements and dead null check removal in block creation are low-priority cleanup
  • Does not change mining behavior, template construction, or template validity
  • CI is failing so check whether the failure belongs to this PR before a deep review
  • Concept approval because it adds useful clarity to block template creation (Sjors)
  • Concept approval without stated reasons (sedited, stickies-v)
  • 30 lines added or modified outside tests
  • 13 lines added or modified in tests
  • 34 lines removed in total
  • 20 files, 3 commits
Reviewability: ReadyStalePaused
Agreement: StrongPositivePositive w/ caveatsNeutralMildDisputedBlockedCrickets
Reviews: current code-review ACKs, then (+stale ACKs) and -NACKs; greener = more ACKs.
Size: lines added or modified outside tests, then in tests; greener = smaller.
Ranking pass (2026-11-01): all PRs here were compared with each other; 12 notes on review order, overlaps, and band changes.

Covers

Block template construction and everything a miner or pool interacts with: the block assembler, getblocktemplate and related RPCs, the Mining interface and its IPC exposure, template update logic (fee inflow, new tip, waitNext), the bitcoin-mine program, and the tests for these. A mining PR that adds or changes an interfaces::Mining method or its capnp definition is mining first and ipc second. The Mining label is a strong prior.

Not mining: general IPC infrastructure that the mining interface happens to use (that is ipc); mempool policy that affects which transactions are eligible (that is mempool).

What matters here

Template validity above all: a template that produces an invalid block loses the block reward. Then correctness of fee and weight accounting, and of template updates as the mempool and tip change. Then latency and resource use of template generation, which pools feel per block. Then completeness and stability of the interface external miners build on (Stratum v2 template providers are the current consumer). Then developer-facing tooling.

Changes whose benefit is a small fraction of a block's fees, weighed against any risk of invalidity, rank low; say so with the numbers when the discussion has them.

generated 2026-11-02 01:17 UTC