refactor: use CTransactionRef in submitSolution

This commit is contained in:
Sjors Provoost 2024-10-31 11:05:05 -07:00
parent 2e81791d90
commit 4d57288246
No known key found for this signature in database
GPG key ID: 57FF9BDBCC301009
2 changed files with 4 additions and 6 deletions

View file

@ -55,7 +55,7 @@ public:
*
* @returns if the block was processed, independent of block validity
*/
virtual bool submitSolution(uint32_t version, uint32_t timestamp, uint32_t nonce, CMutableTransaction coinbase) = 0;
virtual bool submitSolution(uint32_t version, uint32_t timestamp, uint32_t nonce, CTransactionRef coinbase) = 0;
};
//! Interface giving clients (RPC, Stratum v2 Template Provider in the future)

View file

@ -916,16 +916,14 @@ public:
return TransactionMerklePath(m_block_template->block, 0);
}
bool submitSolution(uint32_t version, uint32_t timestamp, uint32_t nonce, CMutableTransaction coinbase) override
bool submitSolution(uint32_t version, uint32_t timestamp, uint32_t nonce, CTransactionRef coinbase) override
{
CBlock block{m_block_template->block};
auto cb = MakeTransactionRef(std::move(coinbase));
if (block.vtx.size() == 0) {
block.vtx.push_back(cb);
block.vtx.push_back(coinbase);
} else {
block.vtx[0] = cb;
block.vtx[0] = coinbase;
}
block.nVersion = version;