Merge 99a8eb6051 into merged_master (Bitcoin PR #19854)

This commit is contained in:
Andrew Poelstra 2020-11-28 22:40:46 +00:00
commit 08ceba023e
2 changed files with 16 additions and 13 deletions

View file

@ -929,9 +929,9 @@ void CTxMemPool::PrioritiseTransaction(const uint256& hash, const CAmount& nFeeD
LogPrintf("PrioritiseTransaction: %s feerate += %s\n", hash.ToString(), FormatMoney(nFeeDelta));
}
void CTxMemPool::ApplyDelta(const uint256 hash, CAmount &nFeeDelta) const
void CTxMemPool::ApplyDelta(const uint256& hash, CAmount &nFeeDelta) const
{
LOCK(cs);
AssertLockHeld(cs);
std::map<uint256, CAmount>::const_iterator pos = mapDeltas.find(hash);
if (pos == mapDeltas.end())
return;
@ -939,9 +939,9 @@ void CTxMemPool::ApplyDelta(const uint256 hash, CAmount &nFeeDelta) const
nFeeDelta += delta;
}
void CTxMemPool::ClearPrioritisation(const uint256 hash)
void CTxMemPool::ClearPrioritisation(const uint256& hash)
{
LOCK(cs);
AssertLockHeld(cs);
mapDeltas.erase(hash);
}
@ -1050,6 +1050,7 @@ void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, bool validFeeEstimat
void CTxMemPool::UpdateChild(txiter entry, txiter child, bool add)
{
AssertLockHeld(cs);
setEntries s;
if (add && mapLinks[entry].children.insert(child).second) {
cachedInnerUsage += memusage::IncrementalDynamicUsage(s);
@ -1060,6 +1061,7 @@ void CTxMemPool::UpdateChild(txiter entry, txiter child, bool add)
void CTxMemPool::UpdateParent(txiter entry, txiter parent, bool add)
{
AssertLockHeld(cs);
setEntries s;
if (add && mapLinks[entry].parents.insert(parent).second) {
cachedInnerUsage += memusage::IncrementalDynamicUsage(s);

View file

@ -573,8 +573,8 @@ private:
typedef std::map<txiter, TxLinks, CompareIteratorByHash> txlinksMap;
txlinksMap mapLinks;
void UpdateParent(txiter entry, txiter parent, bool add);
void UpdateChild(txiter entry, txiter child, bool add);
void UpdateParent(txiter entry, txiter parent, bool add) EXCLUSIVE_LOCKS_REQUIRED(cs);
void UpdateChild(txiter entry, txiter child, bool add) EXCLUSIVE_LOCKS_REQUIRED(cs);
std::vector<indexed_transaction_set::const_iterator> GetSortedDepthAndScore() const EXCLUSIVE_LOCKS_REQUIRED(cs);
@ -632,8 +632,8 @@ public:
/** Affect CreateNewBlock prioritisation of transactions */
void PrioritiseTransaction(const uint256& hash, const CAmount& nFeeDelta);
void ApplyDelta(const uint256 hash, CAmount &nFeeDelta) const;
void ClearPrioritisation(const uint256 hash);
void ApplyDelta(const uint256& hash, CAmount &nFeeDelta) const EXCLUSIVE_LOCKS_REQUIRED(cs);
void ClearPrioritisation(const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED(cs);
/** Get the transaction in the pool that spends the same prevout */
const CTransaction* GetConflictTx(const COutPoint& prevout) const EXCLUSIVE_LOCKS_REQUIRED(cs);
@ -716,9 +716,9 @@ public:
return mapTx.size();
}
uint64_t GetTotalTxSize() const
uint64_t GetTotalTxSize() const EXCLUSIVE_LOCKS_REQUIRED(cs)
{
LOCK(cs);
AssertLockHeld(cs);
return totalTxSize;
}
@ -763,9 +763,10 @@ public:
}
/** Returns whether a txid is in the unbroadcast set */
bool IsUnbroadcastTx(const uint256& txid) const {
LOCK(cs);
return (m_unbroadcast_txids.count(txid) != 0);
bool IsUnbroadcastTx(const uint256& txid) const EXCLUSIVE_LOCKS_REQUIRED(cs)
{
AssertLockHeld(cs);
return m_unbroadcast_txids.count(txid) != 0;
}
private: