refactor: use CTransactionRef in submitSolution

This commit is contained in:
Sjors Provoost committed 2024-12-17 10:12:31 +07:00
1 parent 2e81791d90
commit 4d57288246
2 files changed
+4 -6

No files matched your search

+1 -1
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)
+3 -5
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;