mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-12 19:20:42 +02:00
interfaces/mining: Add createNewBlock2 that does not override or lose options
This commit is contained in:
parent
275a540ea8
commit
23fd2eb9b1
@ -40,13 +40,14 @@ public:
|
||||
virtual std::optional<uint256> getTipHash() = 0;
|
||||
|
||||
/**
|
||||
* Construct a new block template
|
||||
* Construct a new block template. For the createNewBlock variant, subclass options (if any) are silently lost and overridden by any config args. For createNewBlock2, the options are assumed to be complete.
|
||||
*
|
||||
* @param[in] script_pub_key the coinbase output
|
||||
* @param[in] options options for creating the block
|
||||
* @returns a block template
|
||||
*/
|
||||
virtual std::unique_ptr<node::CBlockTemplate> createNewBlock(const CScript& script_pub_key, const node::BlockCreateOptions& options={}) = 0;
|
||||
virtual std::unique_ptr<node::CBlockTemplate> createNewBlock2(const CScript& script_pub_key, const node::BlockCreateOptions& assemble_options) = 0;
|
||||
|
||||
/**
|
||||
* Processes new block. A valid new block is automatically relayed to peers.
|
||||
|
@ -913,6 +913,11 @@ public:
|
||||
{
|
||||
BlockAssembler::Options assemble_options{options};
|
||||
ApplyArgsManOptions(*Assert(m_node.args), assemble_options);
|
||||
return createNewBlock2(script_pub_key, assemble_options);
|
||||
}
|
||||
|
||||
std::unique_ptr<CBlockTemplate> createNewBlock2(const CScript& script_pub_key, const BlockCreateOptions& assemble_options) override
|
||||
{
|
||||
return BlockAssembler{chainman().ActiveChainstate(), context()->mempool.get(), assemble_options}.CreateNewBlock(script_pub_key);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user