refactor: Use NotNull for CreateNewBlock and pimpls

bitcoin/bitcoin: PR #36451

1 suggestion

Earlier concerns neither republished nor resolved: 2 suggestions. See the Run archive for their assessments.

Optional improvements

Link

[suggestion] · getblocktemplate retains a dead post-creation null check

The new NotNullUniquePtr return contract leaves getblocktemplate's pre-existing post-assignment null check redundant, retaining an untestable error branch that the other mining RPC changes remove.

Location: src/rpc/mining.cpp:909 (head).

Details and suggested fix

On refresh, CreateNewTemplate({}) returns a fresh NotNull result that is consumed once into the static std::unique_ptr. Assembly failures throw before the assignment, so they cannot reach CHECK_NONFATAL(block_template). Remove this check as well. Keep the nullable cache and CHECK_NONFATAL(pindexPrev): the cache starts empty, and pindexPrev is cleared before refresh and set only after a successful assignment. If creation throws, the null pindexPrev forces a retry on the next call. This removes unreachable error handling without changing RPC behavior.


Coverage details

Earlier concerns

Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.