mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 13:42:10 +02:00
mining: add reason and debug output to submitSolution
Add reason and debug output parameters to submitSolution, matching submitBlock. This relays the specific failure reason (e.g. "bad-version(...)", "bad-witness-nonce-size", "duplicate") to callers instead of just a bool. Use a new capnp ordinal for the updated method and keep the old @7 method as a deprecated entry point returning an explicit error, so old clients do not decode corrupt result fields and are directed to update.
This commit is contained in:
@@ -917,12 +917,12 @@ public:
|
||||
return TransactionMerklePath(m_block_template->block, 0);
|
||||
}
|
||||
|
||||
bool submitSolution(uint32_t version, uint32_t timestamp, uint32_t nonce, CTransactionRef coinbase) override
|
||||
bool submitSolution(uint32_t version, uint32_t timestamp, uint32_t nonce, CTransactionRef coinbase, std::string& reason, std::string& debug) override
|
||||
{
|
||||
AddMerkleRootAndCoinbase(m_block_template->block, std::move(coinbase), version, timestamp, nonce);
|
||||
std::string reason;
|
||||
std::string debug;
|
||||
return SubmitBlock(chainman(), std::make_shared<const CBlock>(m_block_template->block), /*new_block=*/nullptr, reason, debug);
|
||||
bool new_block;
|
||||
const bool accepted = SubmitBlock(chainman(), std::make_shared<const CBlock>(m_block_template->block), &new_block, reason, debug);
|
||||
return accepted && new_block && reason.empty();
|
||||
}
|
||||
|
||||
std::unique_ptr<BlockTemplate> waitNext(BlockWaitOptions options) override
|
||||
|
||||
Reference in New Issue
Block a user