Closes #3134 - Least Authority Issue E
CTxMemPool::check() does nothing when turned on, due to overflow.
This commit is contained in:
parent
079d9e6a57
commit
a0c977ca61
|
@ -212,4 +212,14 @@ BOOST_AUTO_TEST_CASE(RemoveWithoutBranchId) {
|
||||||
BOOST_CHECK_EQUAL(pool.size(), 0);
|
BOOST_CHECK_EQUAL(pool.size(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test that nCheckFrequency is set correctly when calling setSanityCheck().
|
||||||
|
// https://github.com/zcash/zcash/issues/3134
|
||||||
|
BOOST_AUTO_TEST_CASE(SetSanityCheck) {
|
||||||
|
CTxMemPool pool(CFeeRate(0));
|
||||||
|
pool.setSanityCheck(1.0);
|
||||||
|
BOOST_CHECK_EQUAL(pool.GetCheckFrequency(), 4294967295);
|
||||||
|
pool.setSanityCheck(0);
|
||||||
|
BOOST_CHECK_EQUAL(pool.GetCheckFrequency(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
|
@ -161,7 +161,7 @@ public:
|
||||||
* check does nothing.
|
* check does nothing.
|
||||||
*/
|
*/
|
||||||
void check(const CCoinsViewCache *pcoins) const;
|
void check(const CCoinsViewCache *pcoins) const;
|
||||||
void setSanityCheck(double dFrequency = 1.0) { nCheckFrequency = dFrequency * 4294967296.0; }
|
void setSanityCheck(double dFrequency = 1.0) { nCheckFrequency = static_cast<uint32_t>(dFrequency * 4294967295.0); }
|
||||||
|
|
||||||
bool addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry, bool fCurrentEstimate = true);
|
bool addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry, bool fCurrentEstimate = true);
|
||||||
void remove(const CTransaction &tx, std::list<CTransaction>& removed, bool fRecursive = false);
|
void remove(const CTransaction &tx, std::list<CTransaction>& removed, bool fRecursive = false);
|
||||||
|
@ -219,6 +219,11 @@ public:
|
||||||
bool ReadFeeEstimates(CAutoFile& filein);
|
bool ReadFeeEstimates(CAutoFile& filein);
|
||||||
|
|
||||||
size_t DynamicMemoryUsage() const;
|
size_t DynamicMemoryUsage() const;
|
||||||
|
|
||||||
|
/** Return nCheckFrequency */
|
||||||
|
uint32_t GetCheckFrequency() const {
|
||||||
|
return nCheckFrequency;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue