5 suggestions
Earlier concerns neither republished nor resolved: 1 minor finding · 2 suggestions. See the Run archive for their assessments.
Optional improvements
[suggestion] · The TxCollection count limit does not bound retained weight
One TxCollection can retain many blocks' worth of transaction data after failed validation; bounding that retention would be hardening, not a demonstrated remote-attack fix.
Location: src/node/tx_collection.cpp:99 (head).
Details and suggested fix
AddMissingTxs() checks batch count, nulls, membership and duplicates, but stores newly filled entries without weight accounting. Repeated small batches can therefore accumulate far more than MAX_BLOCK_WEIGHT. MakeTemplate() copies these references into a temporary block, so its eventual validation failure leaves the original data retained until the collection is destroyed. This is separate from the acknowledged IPC-size limitation before deserialization.
Cap cumulative transaction weight at MAX_BLOCK_WEIGHT, including constructor-time mempool matches. Under m_mutex, preflight the weight of only newly filled entries before committing each batch. This preserves atomic rejection and idempotent resubmission without excluding any transaction set that fits in a valid block. Add tests for crossing the cap across calls and leaving the collection unchanged after rejection. Socket clients already have RPC-level authority and can create multiple collections; downstream JDS upload limits are unknown.
[suggestion] · The makeTemplate() tests omit script-invalid client transactions
Every makeTemplate() negative case rejects for something other than script failure, leaving script verification of client-supplied transactions without a regression assertion.
Location: src/test/tx_collection_tests.cpp:156 (head).
Details and suggested fix
template_transactions supplies a correctly signed parent and an OP_TRUE child, while the IPC workflow supplies mempool-accepted transactions. Add a negative case before the parent is mined: copy parent, clear vin[0].scriptSig, request the modified transaction's wtxid in a fresh collection, and supply it through AddMissingTxs(). The fixture's first coinbase is mature and pays to <pubkey> OP_CHECKSIG, so MakeTemplate(tip, {}, ...) should return no template with a block-script-verify-flag-failed reason. Using the modified wtxid and generated coinbase avoids membership or commitment failures masking the intended check. Keep the valid parent/child case as the passing control. Production currently performs these script checks through TestBlockValidity().
[suggestion] · The makeTemplate() docs omit the dummy coinbase's limits
Null-coinbase makeTemplate() success does not guarantee that the caller's coinbase fits the block's weight and sigop limits; no current production caller relying on this guarantee was found.
Location: src/interfaces/mining.h:168 (head).
Details and suggested fix
The null branch builds an OP_TRUE dummy paying only the subsidy, then validates the block with that dummy's actual weight and sigops. It never applies the ordinary assembler's block_reserved_weight or coinbase_output_max_additional_sigops reservations. Near either consensus limit, replacing the dummy through submitSolution() can therefore cause bad-blk-weight or bad-blk-sigops. Document that null-coinbase success validates only the dummy, not the intended coinbase's reward, weight or sigops, and advise callers needing those checks to pass their intended coinbase.
[suggestion] · collectTxs() does not document coinbase exclusion
The input contract says “final block order” without excluding the coinbase, although passing and completing a whole-block list makes makeTemplate() reject it with bad-cb-multiple.
Location: src/interfaces/mining.h:286 (head).
Details and suggested fix
MakeTemplate() reserves vtx[0] for a supplied or generated coinbase and appends every collected transaction after it; it does not filter collected coinbases. Consequently, position zero from unknownTxPos() corresponds to block.vtx[1], not block.vtx[0]. The IPC test already follows this convention with remote_block.vtx[1:]. State in the collectTxs() parameter comment and TxCollection usage note that the list contains only non-coinbase transactions in final order, that missing positions index this list, and that callers supply a coinbase separately through makeTemplate().
[suggestion] · The TxCollection IPC additions are missing from release notes
The new Mining.collectTxs workflow and external-template restrictions have no release note to help mining-client developers discover the interface.
Location: src/ipc/capnp/mining.capnp:31 (head).
Details and suggested fix
mining.capnp adds a public API covered by the release-note criteria in doc/developer-notes.md. Add a uniquely named doc/release-notes-*.md note describing the collectTxs() → addMissingTxs() → makeTemplate() workflow and its wtxid-count limit. Also mention that external templates reject getTxFees(), getTxSigops(), getCoinbaseTx(), waitNext() and interruptWait(). Earlier transaction-lookup additions have no pending note, so precedent is mixed and this is low priority.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [suggestion]: Bound transaction payload bytes before IPC deserialization
- [minor]: Validate supplied signet solutions during template creation
- [suggestion]: Remove the unused Python transaction-weight constant
Background
Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.
Documented decisions
Avoiding a complete JDS mempool mirror was already an explicit latency-versus-resource tradeoff.
The RawTxFeed discussion considered keeping transactions immediately available to minimize job-approval latency, but also raised the cost of streaming every transaction and retaining transactions that never enter templates. Its author ultimately accepted on-demand witness-ID lookup, with reconsideration if round trips became a bottleneck. The checkBlock proposal separately motivated IPC by avoiding JSON serialization of up to 4 MB of transaction data. TxCollection continues this effort to reduce data movement without weakening the separate validity check.
Source 1 · Source 2 · Source 3 · Source 4 · Source 5 · Source 6
Unresolved disagreements
The inspected historical record does not settle how aggressively old mining objects should be retired when retention competes with memory bounds.
Sjors emphasized client knowledge of downstream forwarding and delayed solutions; Ryan Ofsky discussed a configurable memory cap with overload exceptions and questioned automatic eviction complexity; plebhash later argued that economically rational miners generally use the latest, most profitable template, with a safety window for transitions. These positions affect the interpretation of retained TxCollection and BlockTemplate resources, but do not establish one universal lifetime policy.