mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-04 20:51:27 +02:00
miner: Make UpdatePackagesForAdded static
Since UpdatePackagesForAdded is a helper function that's only used in addPackageTxs we can make it static and avoid the unnecessary interface and in-header lock annotation.
This commit is contained in:
@ -232,15 +232,19 @@ void BlockAssembler::AddToBlock(CTxMemPool::txiter iter)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int BlockAssembler::UpdatePackagesForAdded(const CTxMemPool::setEntries& alreadyAdded,
|
/** Add descendants of given transactions to mapModifiedTx with ancestor
|
||||||
indexed_modified_transaction_set &mapModifiedTx)
|
* state updated assuming given transactions are inBlock. Returns number
|
||||||
|
* of updated descendants. */
|
||||||
|
static int UpdatePackagesForAdded(const CTxMemPool& mempool,
|
||||||
|
const CTxMemPool::setEntries& alreadyAdded,
|
||||||
|
indexed_modified_transaction_set& mapModifiedTx) EXCLUSIVE_LOCKS_REQUIRED(mempool.cs)
|
||||||
{
|
{
|
||||||
AssertLockHeld(m_mempool.cs);
|
AssertLockHeld(mempool.cs);
|
||||||
|
|
||||||
int nDescendantsUpdated = 0;
|
int nDescendantsUpdated = 0;
|
||||||
for (CTxMemPool::txiter it : alreadyAdded) {
|
for (CTxMemPool::txiter it : alreadyAdded) {
|
||||||
CTxMemPool::setEntries descendants;
|
CTxMemPool::setEntries descendants;
|
||||||
m_mempool.CalculateDescendants(it, descendants);
|
mempool.CalculateDescendants(it, descendants);
|
||||||
// Insert all descendants (not yet in block) into the modified set
|
// Insert all descendants (not yet in block) into the modified set
|
||||||
for (CTxMemPool::txiter desc : descendants) {
|
for (CTxMemPool::txiter desc : descendants) {
|
||||||
if (alreadyAdded.count(desc)) {
|
if (alreadyAdded.count(desc)) {
|
||||||
@ -421,7 +425,7 @@ void BlockAssembler::addPackageTxs(int& nPackagesSelected, int& nDescendantsUpda
|
|||||||
++nPackagesSelected;
|
++nPackagesSelected;
|
||||||
|
|
||||||
// Update transactions that depend on each of these
|
// Update transactions that depend on each of these
|
||||||
nDescendantsUpdated += UpdatePackagesForAdded(ancestors, mapModifiedTx);
|
nDescendantsUpdated += UpdatePackagesForAdded(m_mempool, ancestors, mapModifiedTx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace node
|
} // namespace node
|
||||||
|
@ -191,10 +191,6 @@ private:
|
|||||||
bool TestPackageTransactions(const CTxMemPool::setEntries& package) const;
|
bool TestPackageTransactions(const CTxMemPool::setEntries& package) const;
|
||||||
/** 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, std::vector<CTxMemPool::txiter>& sortedEntries);
|
void SortForBlock(const CTxMemPool::setEntries& package, std::vector<CTxMemPool::txiter>& sortedEntries);
|
||||||
/** Add descendants of given transactions to mapModifiedTx with ancestor
|
|
||||||
* state updated assuming given transactions are inBlock. Returns number
|
|
||||||
* of updated descendants. */
|
|
||||||
int UpdatePackagesForAdded(const CTxMemPool::setEntries& alreadyAdded, indexed_modified_transaction_set& mapModifiedTx) EXCLUSIVE_LOCKS_REQUIRED(m_mempool.cs);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev);
|
int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev);
|
||||||
|
Reference in New Issue
Block a user