mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
miner: Make mempool optional for BlockAssembler
...also adjust callers Changes: - In BlockAssembler::CreateNewBlock, we now only lock m_mempool->cs and call addPackageTxs if m_mempool is not nullptr - BlockAssembler::addPackageTxs now takes in a mempool reference, and is annotated to require that mempool's lock. - In TestChain100Setup::CreateBlock and generateblock, don't construct an empty mempool, just pass in a nullptr for mempool
This commit is contained in:
@@ -147,7 +147,7 @@ private:
|
||||
int64_t m_lock_time_cutoff;
|
||||
|
||||
const CChainParams& chainparams;
|
||||
const CTxMemPool& m_mempool;
|
||||
const CTxMemPool* const m_mempool;
|
||||
CChainState& m_chainstate;
|
||||
|
||||
public:
|
||||
@@ -157,8 +157,8 @@ public:
|
||||
CFeeRate blockMinFeeRate;
|
||||
};
|
||||
|
||||
explicit BlockAssembler(CChainState& chainstate, const CTxMemPool& mempool);
|
||||
explicit BlockAssembler(CChainState& chainstate, const CTxMemPool& mempool, const Options& options);
|
||||
explicit BlockAssembler(CChainState& chainstate, const CTxMemPool* mempool);
|
||||
explicit BlockAssembler(CChainState& chainstate, const CTxMemPool* mempool, const Options& options);
|
||||
|
||||
/** Construct a new block template with coinbase to scriptPubKeyIn */
|
||||
std::unique_ptr<CBlockTemplate> CreateNewBlock(const CScript& scriptPubKeyIn);
|
||||
@@ -177,7 +177,7 @@ private:
|
||||
/** Add transactions based on feerate including unconfirmed ancestors
|
||||
* Increments nPackagesSelected / nDescendantsUpdated with corresponding
|
||||
* statistics from the package selection (for logging statistics). */
|
||||
void addPackageTxs(int& nPackagesSelected, int& nDescendantsUpdated) EXCLUSIVE_LOCKS_REQUIRED(m_mempool.cs);
|
||||
void addPackageTxs(const CTxMemPool& mempool, int& nPackagesSelected, int& nDescendantsUpdated) EXCLUSIVE_LOCKS_REQUIRED(mempool.cs);
|
||||
|
||||
// helper functions for addPackageTxs()
|
||||
/** Remove confirmed (inBlock) entries from given set */
|
||||
|
||||
Reference in New Issue
Block a user