Changeset View
Changeset View
Standalone View
Standalone View
src/miner.h
Show First 20 Lines • Show All 180 Lines • ▼ Show 20 Lines | struct update_for_parent_inclusion { | ||||
} | } | ||||
CTxMemPool::txiter iter; | CTxMemPool::txiter iter; | ||||
}; | }; | ||||
/** Generate a new block, without valid proof-of-work */ | /** Generate a new block, without valid proof-of-work */ | ||||
class BlockAssembler { | class BlockAssembler { | ||||
private: | private: | ||||
typedef std::unordered_set<TxId, SaltedTxidHasher> TxIdSet; | |||||
// The constructed block template | // The constructed block template | ||||
std::unique_ptr<CBlockTemplate> pblocktemplate; | std::unique_ptr<CBlockTemplate> pblocktemplate; | ||||
// A convenience pointer that always refers to the CBlock in pblocktemplate | // A convenience pointer that always refers to the CBlock in pblocktemplate | ||||
CBlock *pblock; | CBlock *pblock; | ||||
// Configuration parameters for the block size | // Configuration parameters for the block size | ||||
uint64_t nMaxGeneratedBlockSize; | uint64_t nMaxGeneratedBlockSize; | ||||
CFeeRate blockMinFeeRate; | CFeeRate blockMinFeeRate; | ||||
// Information on the current status of the block | // Information on the current status of the block | ||||
uint64_t nBlockSize; | uint64_t nBlockSize; | ||||
uint64_t nBlockTx; | uint64_t nBlockTx; | ||||
uint64_t nBlockSigOps; | uint64_t nBlockSigOps; | ||||
Amount nFees; | Amount nFees; | ||||
CTxMemPool::setEntries inBlock; | TxIdSet inBlock; | ||||
// Chain context for the block | // Chain context for the block | ||||
int nHeight; | int nHeight; | ||||
int64_t nLockTimeCutoff; | int64_t nLockTimeCutoff; | ||||
int64_t nMedianTimePast; | int64_t nMedianTimePast; | ||||
const Config *config; | const Config *config; | ||||
const CTxMemPool *mempool; | const CTxMemPool *mempool; | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | private: | ||||
* locktime, serialized size (if necessary) | * locktime, serialized size (if necessary) | ||||
* These checks should always succeed, and they're here | * These checks should always succeed, and they're here | ||||
* only as an extra check in case of suboptimal node configuration */ | * only as an extra check in case of suboptimal node configuration */ | ||||
bool TestPackageTransactions(const CTxMemPool::setEntries &package); | bool TestPackageTransactions(const CTxMemPool::setEntries &package); | ||||
/** Return true if given transaction from mapTx has already been evaluated, | /** Return true if given transaction from mapTx has already been evaluated, | ||||
* or if the transaction's cached data in mapTx is incorrect. */ | * or if the transaction's cached data in mapTx is incorrect. */ | ||||
bool SkipMapTxEntry(CTxMemPool::txiter it, | bool SkipMapTxEntry(CTxMemPool::txiter it, | ||||
indexed_modified_transaction_set &mapModifiedTx, | indexed_modified_transaction_set &mapModifiedTx, | ||||
CTxMemPool::setEntries &failedTx); | const TxIdSet &failedTx); | ||||
/** Sort the package in an order that is valid to appear in a block */ | /** Sort the package in an order that is valid to appear in a block */ | ||||
void SortForBlock(const CTxMemPool::setEntries &package, | void SortForBlock(const CTxMemPool::setEntries &package, | ||||
CTxMemPool::txiter entry, | CTxMemPool::txiter entry, | ||||
std::vector<CTxMemPool::txiter> &sortedEntries); | std::vector<CTxMemPool::txiter> &sortedEntries); | ||||
/** Add descendants of given transactions to mapModifiedTx with ancestor | /** Add descendants of given transactions to mapModifiedTx with ancestor | ||||
* state updated assuming given transactions are inBlock. Returns number | * state updated assuming given transactions are inBlock. Returns number | ||||
* of updated descendants. */ | * of updated descendants. */ | ||||
int UpdatePackagesForAdded(const CTxMemPool::setEntries &alreadyAdded, | int UpdatePackagesForAdded(const CTxMemPool::setEntries &alreadyAdded, | ||||
indexed_modified_transaction_set &mapModifiedTx); | indexed_modified_transaction_set &mapModifiedTx); | ||||
int UpdatePackagesForAdded(const TxIdSet &alreadyAdded, | |||||
indexed_modified_transaction_set &mapModifiedTx); | |||||
}; | }; | ||||
/** Modify the extranonce in a block */ | /** Modify the extranonce in a block */ | ||||
void IncrementExtraNonce(const Config &config, CBlock *pblock, | void IncrementExtraNonce(const Config &config, CBlock *pblock, | ||||
const CBlockIndex *pindexPrev, | const CBlockIndex *pindexPrev, | ||||
unsigned int &nExtraNonce); | unsigned int &nExtraNonce); | ||||
int64_t UpdateTime(CBlockHeader *pblock, const Config &config, | int64_t UpdateTime(CBlockHeader *pblock, const Config &config, | ||||
const CBlockIndex *pindexPrev); | const CBlockIndex *pindexPrev); | ||||
#endif // BITCOIN_MINER_H | #endif // BITCOIN_MINER_H |