Followups from #30200
Fixes:
std::unique_ptr
needs#include <memory>
(noticed while working on #30332, which has fewer includes than its parent PR that I originally tested with)- Drop lock from createNewBlock that was spuriously added
- Have testBlockValidity hold cs_main instead of caller (also fixes a race condition in test-only code)
Refactor:
- Use CHECK_NONFATAL to avoid single-use symbol (refactor)
- move output argument
state
to the end oftestBlockValidity
, see #30200 (review)