mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
refactor: use CTransactionRef in submitSolution
This commit is contained in:
parent
2e81791d90
commit
4d57288246
2 changed files with 4 additions and 6 deletions
|
@ -55,7 +55,7 @@ public:
|
||||||
*
|
*
|
||||||
* @returns if the block was processed, independent of block validity
|
* @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)
|
//! Interface giving clients (RPC, Stratum v2 Template Provider in the future)
|
||||||
|
|
|
@ -916,16 +916,14 @@ public:
|
||||||
return TransactionMerklePath(m_block_template->block, 0);
|
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};
|
CBlock block{m_block_template->block};
|
||||||
|
|
||||||
auto cb = MakeTransactionRef(std::move(coinbase));
|
|
||||||
|
|
||||||
if (block.vtx.size() == 0) {
|
if (block.vtx.size() == 0) {
|
||||||
block.vtx.push_back(cb);
|
block.vtx.push_back(coinbase);
|
||||||
} else {
|
} else {
|
||||||
block.vtx[0] = cb;
|
block.vtx[0] = coinbase;
|
||||||
}
|
}
|
||||||
|
|
||||||
block.nVersion = version;
|
block.nVersion = version;
|
||||||
|
|
Loading…
Add table
Reference in a new issue