mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 23:03:45 +01:00
Add checkBlock to Mining interface
Use it in miner_tests. The getblocktemplate and generateblock RPC calls don't use this, because it would make the code more verbose.
This commit is contained in:
@@ -984,6 +984,15 @@ public:
|
||||
return std::make_unique<BlockTemplateImpl>(assemble_options, BlockAssembler{chainman().ActiveChainstate(), context()->mempool.get(), assemble_options}.CreateNewBlock(), m_node);
|
||||
}
|
||||
|
||||
bool checkBlock(const CBlock& block, const node::BlockCheckOptions& options, std::string& reason, std::string& debug) override
|
||||
{
|
||||
LOCK(chainman().GetMutex());
|
||||
BlockValidationState state{TestBlockValidity(chainman().ActiveChainstate(), block, /*check_pow=*/options.check_pow, /*=check_merkle_root=*/options.check_merkle_root)};
|
||||
reason = state.GetRejectReason();
|
||||
debug = state.GetDebugMessage();
|
||||
return state.IsValid();
|
||||
}
|
||||
|
||||
NodeContext* context() override { return &m_node; }
|
||||
ChainstateManager& chainman() { return *Assert(m_node.chainman); }
|
||||
KernelNotifications& notifications() { return *Assert(m_node.notifications); }
|
||||
|
||||
Reference in New Issue
Block a user