test util: split up ConnectBlock from MineBlock

This commit is contained in:
Antoine Poinsot 2025-02-20 10:18:21 -05:00
parent d1527f6b88
commit 3b85eba83a
2 changed files with 10 additions and 0 deletions

View file

@ -92,6 +92,11 @@ COutPoint MineBlock(const NodeContext& node, std::shared_ptr<CBlock>& block)
assert(block->nNonce); assert(block->nNonce);
} }
return ProcessBlock(node, block);
}
COutPoint ProcessBlock(const NodeContext& node, const std::shared_ptr<CBlock>& block)
{
auto& chainman{*Assert(node.chainman)}; auto& chainman{*Assert(node.chainman)};
const auto old_height = WITH_LOCK(chainman.GetMutex(), return chainman.ActiveHeight()); const auto old_height = WITH_LOCK(chainman.GetMutex(), return chainman.ActiveHeight());
bool new_block; bool new_block;

View file

@ -32,6 +32,11 @@ COutPoint MineBlock(const node::NodeContext&,
**/ **/
COutPoint MineBlock(const node::NodeContext&, std::shared_ptr<CBlock>& block); COutPoint MineBlock(const node::NodeContext&, std::shared_ptr<CBlock>& block);
/**
* Returns the generated coin (or Null if the block was invalid).
*/
COutPoint ProcessBlock(const node::NodeContext&, const std::shared_ptr<CBlock>& block);
/** Prepare a block to be mined */ /** Prepare a block to be mined */
std::shared_ptr<CBlock> PrepareBlock(const node::NodeContext&); std::shared_ptr<CBlock> PrepareBlock(const node::NodeContext&);
std::shared_ptr<CBlock> PrepareBlock(const node::NodeContext& node, std::shared_ptr<CBlock> PrepareBlock(const node::NodeContext& node,