Changeset View
Changeset View
Standalone View
Standalone View
src/miner.h
Show First 20 Lines • Show All 227 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
/** Modify the extranonce in a block */ | /** Modify the extranonce in a block */ | ||||
void IncrementExtraNonce(CBlock *pblock, const CBlockIndex *pindexPrev, | void IncrementExtraNonce(CBlock *pblock, const CBlockIndex *pindexPrev, | ||||
uint64_t nExcessiveBlockSize, | uint64_t nExcessiveBlockSize, | ||||
unsigned int &nExtraNonce); | unsigned int &nExtraNonce); | ||||
int64_t UpdateTime(CBlockHeader *pblock, const CChainParams &chainParams, | int64_t UpdateTime(CBlockHeader *pblock, const CChainParams &chainParams, | ||||
const CBlockIndex *pindexPrev); | const CBlockIndex *pindexPrev); | ||||
using BlockTemplateId = uint64_t; | |||||
/** | |||||
* BlockTemplateManager stores block templates during the mining process | |||||
* to reduce cross-talk between the node and mining software. | |||||
*/ | |||||
class BlockTemplateManager { | |||||
/* | |||||
* Currently, we only store the most recently generated block template as a | |||||
* proof of concept. This will be replaced with an id-addressable container | |||||
* in the future. | |||||
*/ | |||||
std::shared_ptr<CBlockTemplate> blockTemplate; | |||||
public: | |||||
BlockTemplateId | |||||
addBlockTemplate(std::shared_ptr<CBlockTemplate> templateIn); | |||||
std::shared_ptr<CBlockTemplate> getBlockTemplate(BlockTemplateId id); | |||||
}; | |||||
/** | |||||
* Global block template manager instance. | |||||
*/ | |||||
extern std::unique_ptr<BlockTemplateManager> g_block_template_manager; | |||||
#endif // BITCOIN_MINER_H | #endif // BITCOIN_MINER_H |