mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-09-14 04:21:12 +02:00
[refactor] parameterize BlockAssembler::Options in PrepareBlock
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
@@ -5,6 +5,8 @@
|
||||
#ifndef BITCOIN_TEST_UTIL_MINING_H
|
||||
#define BITCOIN_TEST_UTIL_MINING_H
|
||||
|
||||
#include <node/miner.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -25,6 +27,8 @@ CTxIn MineBlock(const node::NodeContext&, const CScript& coinbase_scriptPubKey);
|
||||
|
||||
/** 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& node, const CScript& coinbase_scriptPubKey,
|
||||
const node::BlockAssembler::Options& assembler_options);
|
||||
|
||||
/** RPC-like helper function, returns the generated coin */
|
||||
CTxIn generatetoaddress(const node::NodeContext&, const std::string& address);
|
||||
|
Reference in New Issue
Block a user