refactor: introduce SubmitBlock helper

Introduce a SubmitBlock() helper in node/miner.cpp that wraps
ProcessNewBlock submission and captures validation state through
the BlockChecked callback.

Route submitSolution through the helper before adding any new IPC method.

No behavior change.
This commit is contained in:
w0xlt
2026-05-14 13:17:06 -07:00
parent 9c15022260
commit 813b4a80d7
3 changed files with 64 additions and 1 deletions

View File

@@ -920,7 +920,9 @@ public:
bool submitSolution(uint32_t version, uint32_t timestamp, uint32_t nonce, CTransactionRef coinbase) override
{
AddMerkleRootAndCoinbase(m_block_template->block, std::move(coinbase), version, timestamp, nonce);
return chainman().ProcessNewBlock(std::make_shared<const CBlock>(m_block_template->block), /*force_processing=*/true, /*min_pow_checked=*/true, /*new_block=*/nullptr);
std::string reason;
std::string debug;
return SubmitBlock(chainman(), std::make_shared<const CBlock>(m_block_template->block), /*new_block=*/nullptr, reason, debug);
}
std::unique_ptr<BlockTemplate> waitNext(BlockWaitOptions options) override