mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-02 01:04:43 +02:00
Drop script_pub_key arg from createNewBlock
Providing a script for the coinbase transaction is only done in test code and for CPU solo mining. Production miners use the getblocktemplate RPC which omits the coinbase transaction entirely from its block template, leaving it to external (pool) software to construct it. A coinbase script can still be passed via BlockCreateOptions instead. A temporary overload is added so that the test can be modified in the next commit.
This commit is contained in:
@@ -169,14 +169,22 @@ public:
|
||||
|
||||
explicit BlockAssembler(Chainstate& chainstate, const CTxMemPool* mempool, const Options& options);
|
||||
|
||||
/** Construct a new block template with coinbase to scriptPubKeyIn */
|
||||
std::unique_ptr<CBlockTemplate> CreateNewBlock(const CScript& scriptPubKeyIn);
|
||||
/** Construct a new block template */
|
||||
std::unique_ptr<CBlockTemplate> CreateNewBlock();
|
||||
|
||||
/** Temporary overload for tests */
|
||||
std::unique_ptr<CBlockTemplate> CreateNewBlock(const CScript& scriptPubKeyIn)
|
||||
{
|
||||
m_options.coinbase_output_script = scriptPubKeyIn;
|
||||
return CreateNewBlock();
|
||||
};
|
||||
|
||||
inline static std::optional<int64_t> m_last_block_num_txs{};
|
||||
inline static std::optional<int64_t> m_last_block_weight{};
|
||||
|
||||
private:
|
||||
const Options m_options;
|
||||
// TODO: make const again
|
||||
Options m_options;
|
||||
|
||||
// utility functions
|
||||
/** Clear the block's state and prepare for assembling a new block */
|
||||
|
||||
Reference in New Issue
Block a user