aboutsummaryrefslogtreecommitdiff
path: root/src/test/util/mining.cpp
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2022-12-15 15:15:22 +0000
committerglozow <gloriajzhao@gmail.com>2022-12-22 11:33:37 +0000
commitc0588523083c9c78770b8b19a52a919db56250d9 (patch)
tree6c31af62a29e18aaf0d0cd2c46157a44806a842e /src/test/util/mining.cpp
parenta2de971ba1c588488dde653a76853666429d4911 (diff)
[refactor] parameterize BlockAssembler::Options in PrepareBlock
Diffstat (limited to 'src/test/util/mining.cpp')
-rw-r--r--src/test/util/mining.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/test/util/mining.cpp b/src/test/util/mining.cpp
index faa0b2878c..1942a211a1 100644
--- a/src/test/util/mining.cpp
+++ b/src/test/util/mining.cpp
@@ -8,7 +8,6 @@
#include <consensus/merkle.h>
#include <key_io.h>
#include <node/context.h>
-#include <node/miner.h>
#include <pow.h>
#include <script/standard.h>
#include <test/util/script.h>
@@ -74,10 +73,11 @@ CTxIn MineBlock(const NodeContext& node, const CScript& coinbase_scriptPubKey)
return CTxIn{block->vtx[0]->GetHash(), 0};
}
-std::shared_ptr<CBlock> PrepareBlock(const NodeContext& node, const CScript& coinbase_scriptPubKey)
+std::shared_ptr<CBlock> PrepareBlock(const NodeContext& node, const CScript& coinbase_scriptPubKey,
+ const BlockAssembler::Options& assembler_options)
{
auto block = std::make_shared<CBlock>(
- BlockAssembler{Assert(node.chainman)->ActiveChainstate(), Assert(node.mempool.get())}
+ BlockAssembler{Assert(node.chainman)->ActiveChainstate(), Assert(node.mempool.get()), assembler_options}
.CreateNewBlock(coinbase_scriptPubKey)
->block);
@@ -87,3 +87,9 @@ std::shared_ptr<CBlock> PrepareBlock(const NodeContext& node, const CScript& coi
return block;
}
+std::shared_ptr<CBlock> PrepareBlock(const NodeContext& node, const CScript& coinbase_scriptPubKey)
+{
+ BlockAssembler::Options assembler_options;
+ ApplyArgsManOptions(*node.args, assembler_options);
+ return PrepareBlock(node, coinbase_scriptPubKey, assembler_options);
+}