Browse Source

Merge pull request #6889

0d699fc fix locking issue with new mempool limiting (Jonas Schnelli)
0.13
Wladimir J. van der Laan 9 years ago
parent
commit
38369dda32
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 11
      src/txmempool.cpp
  2. 1
      src/txmempool.h

11
src/txmempool.cpp

@ -309,7 +309,7 @@ void CTxMemPoolEntry::UpdateState(int64_t modifySize, CAmount modifyFee, int64_t @@ -309,7 +309,7 @@ void CTxMemPoolEntry::UpdateState(int64_t modifySize, CAmount modifyFee, int64_t
CTxMemPool::CTxMemPool(const CFeeRate& _minReasonableRelayFee) :
nTransactionsUpdated(0)
{
clear();
_clear(); //lock free clear
// Sanity checks off by default for performance, because otherwise
// accepting transactions becomes O(N^2) where N is the number
@ -546,9 +546,8 @@ void CTxMemPool::removeForBlock(const std::vector<CTransaction>& vtx, unsigned i @@ -546,9 +546,8 @@ void CTxMemPool::removeForBlock(const std::vector<CTransaction>& vtx, unsigned i
blockSinceLastRollingFeeBump = true;
}
void CTxMemPool::clear()
void CTxMemPool::_clear()
{
LOCK(cs);
mapLinks.clear();
mapTx.clear();
mapNextTx.clear();
@ -560,6 +559,12 @@ void CTxMemPool::clear() @@ -560,6 +559,12 @@ void CTxMemPool::clear()
++nTransactionsUpdated;
}
void CTxMemPool::clear()
{
LOCK(cs);
_clear();
}
void CTxMemPool::check(const CCoinsViewCache *pcoins) const
{
if (!fSanityCheck)

1
src/txmempool.h

@ -375,6 +375,7 @@ public: @@ -375,6 +375,7 @@ public:
void removeForBlock(const std::vector<CTransaction>& vtx, unsigned int nBlockHeight,
std::list<CTransaction>& conflicts, bool fCurrentEstimate = true);
void clear();
void _clear(); //lock free
void queryHashes(std::vector<uint256>& vtxid);
void pruneSpent(const uint256& hash, CCoins &coins);
unsigned int GetTransactionsUpdated() const;

Loading…
Cancel
Save