aboutsummaryrefslogtreecommitdiff
path: root/src/node
diff options
context:
space:
mode:
authorSjors Provoost <sjors@sprovoost.nl>2024-06-10 17:27:12 +0200
committerSjors Provoost <sjors@sprovoost.nl>2024-06-18 18:47:51 +0200
commit64ebb0f97178687517c2060bf6b9931064607888 (patch)
tree9ac06633db47c0545052e61727d8351bf0d98a91 /src/node
parent4bf2e361da1964f7c278b4939967a0e5afde20b0 (diff)
downloadbitcoin-64ebb0f97178687517c2060bf6b9931064607888.tar.xz
Always pass options to BlockAssembler constructor
This makes the options argument for BlockAssembler constructor mandatory, dropping implicit use of ArgsManager. The caller i.e. the Mining interface implementation now handles this. In a future Stratum v2 change the Options object needs to be mofified after arguments have been processed. Specifically the pool communicates how many extra bytes it needs for its own outputs (payouts, extra commitments, etc). This will need to be substracted from what the user set as -blockmaxweight. Such a change can be implemented in createNewBlock, after ApplyArgsManOptions.
Diffstat (limited to 'src/node')
-rw-r--r--src/node/interfaces.cpp6
-rw-r--r--src/node/miner.cpp9
-rw-r--r--src/node/miner.h1
3 files changed, 5 insertions, 11 deletions
diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp
index 215dbf5e17..356a01b286 100644
--- a/src/node/interfaces.cpp
+++ b/src/node/interfaces.cpp
@@ -75,6 +75,7 @@ using interfaces::MakeSignalHandler;
using interfaces::Mining;
using interfaces::Node;
using interfaces::WalletLoader;
+using node::BlockAssembler;
using util::Join;
namespace node {
@@ -862,8 +863,11 @@ public:
std::unique_ptr<CBlockTemplate> createNewBlock(const CScript& script_pub_key, bool use_mempool) override
{
+ BlockAssembler::Options options;
+ ApplyArgsManOptions(gArgs, options);
+
LOCK(::cs_main);
- return BlockAssembler{chainman().ActiveChainstate(), use_mempool ? context()->mempool.get() : nullptr}.CreateNewBlock(script_pub_key);
+ return BlockAssembler{chainman().ActiveChainstate(), use_mempool ? context()->mempool.get() : nullptr, options}.CreateNewBlock(script_pub_key);
}
NodeContext* context() override { return &m_node; }
diff --git a/src/node/miner.cpp b/src/node/miner.cpp
index 87f40e993f..03c6d74deb 100644
--- a/src/node/miner.cpp
+++ b/src/node/miner.cpp
@@ -80,15 +80,6 @@ void ApplyArgsManOptions(const ArgsManager& args, BlockAssembler::Options& optio
if (const auto parsed{ParseMoney(*blockmintxfee)}) options.blockMinFeeRate = CFeeRate{*parsed};
}
}
-static BlockAssembler::Options ConfiguredOptions()
-{
- BlockAssembler::Options options;
- ApplyArgsManOptions(gArgs, options);
- return options;
-}
-
-BlockAssembler::BlockAssembler(Chainstate& chainstate, const CTxMemPool* mempool)
- : BlockAssembler(chainstate, mempool, ConfiguredOptions()) {}
void BlockAssembler::resetBlock()
{
diff --git a/src/node/miner.h b/src/node/miner.h
index 06a917228d..c3178a7532 100644
--- a/src/node/miner.h
+++ b/src/node/miner.h
@@ -161,7 +161,6 @@ public:
bool test_block_validity{true};
};
- explicit BlockAssembler(Chainstate& chainstate, const CTxMemPool* mempool);
explicit BlockAssembler(Chainstate& chainstate, const CTxMemPool* mempool, const Options& options);
/** Construct a new block template with coinbase to scriptPubKeyIn */