Skip to content

Commit 3b85eba

Browse files
committed
test util: split up ConnectBlock from MineBlock
1 parent d1527f6 commit 3b85eba

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/test/util/mining.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ COutPoint MineBlock(const NodeContext& node, std::shared_ptr<CBlock>& block)
9292
assert(block->nNonce);
9393
}
9494

95+
return ProcessBlock(node, block);
96+
}
97+
98+
COutPoint ProcessBlock(const NodeContext& node, const std::shared_ptr<CBlock>& block)
99+
{
95100
auto& chainman{*Assert(node.chainman)};
96101
const auto old_height = WITH_LOCK(chainman.GetMutex(), return chainman.ActiveHeight());
97102
bool new_block;

src/test/util/mining.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ COutPoint MineBlock(const node::NodeContext&,
3232
**/
3333
COutPoint MineBlock(const node::NodeContext&, std::shared_ptr<CBlock>& block);
3434

35+
/**
36+
* Returns the generated coin (or Null if the block was invalid).
37+
*/
38+
COutPoint ProcessBlock(const node::NodeContext&, const std::shared_ptr<CBlock>& block);
39+
3540
/** Prepare a block to be mined */
3641
std::shared_ptr<CBlock> PrepareBlock(const node::NodeContext&);
3742
std::shared_ptr<CBlock> PrepareBlock(const node::NodeContext& node,

0 commit comments

Comments
 (0)