[refactor] parameterize BlockAssembler::Options in PrepareBlock
This commit is contained in:
2 files changed
+13
-3
No files matched your search
@@ -8,7 +8,6 @@
|
|||||||
#include <consensus/merkle.h>
|
#include <consensus/merkle.h>
|
||||||
#include <key_io.h>
|
#include <key_io.h>
|
||||||
#include <node/context.h>
|
#include <node/context.h>
|
||||||
#include <node/miner.h>
|
|
||||||
#include <pow.h>
|
#include <pow.h>
|
||||||
#include <script/standard.h>
|
#include <script/standard.h>
|
||||||
#include <test/util/script.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};
|
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>(
|
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)
|
.CreateNewBlock(coinbase_scriptPubKey)
|
||||||
->block);
|
->block);
|
||||||
|
|
||||||
@@ -87,3 +87,9 @@ std::shared_ptr<CBlock> PrepareBlock(const NodeContext& node, const CScript& coi
|
|||||||
|
|
||||||
return block;
|
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);
|
||||||
|
}
|
||||||
@@ -5,6 +5,8 @@
|
|||||||
#ifndef BITCOIN_TEST_UTIL_MINING_H
|
#ifndef BITCOIN_TEST_UTIL_MINING_H
|
||||||
#define BITCOIN_TEST_UTIL_MINING_H
|
#define BITCOIN_TEST_UTIL_MINING_H
|
||||||
|
|
||||||
|
#include <node/miner.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -25,6 +27,8 @@ CTxIn MineBlock(const node::NodeContext&, const CScript& coinbase_scriptPubKey);
|
|||||||
|
|
||||||
/** Prepare a block to be mined */
|
/** Prepare a block to be mined */
|
||||||
std::shared_ptr<CBlock> PrepareBlock(const node::NodeContext&, const CScript& coinbase_scriptPubKey);
|
std::shared_ptr<CBlock> PrepareBlock(const node::NodeContext&, const CScript& coinbase_scriptPubKey);
|
||||||
|
std::shared_ptr<CBlock> PrepareBlock(const node::NodeContext& node, const CScript& coinbase_scriptPubKey,
|
||||||
|
const node::BlockAssembler::Options& assembler_options);
|
||||||
|
|
||||||
/** RPC-like helper function, returns the generated coin */
|
/** RPC-like helper function, returns the generated coin */
|
||||||
CTxIn generatetoaddress(const node::NodeContext&, const std::string& address);
|
CTxIn generatetoaddress(const node::NodeContext&, const std::string& address);
|
||||||
|
|||||||
Reference in new issue
Block a user