diff options
author | Elle Mouton <elle.mouton@gmail.com> | 2020-10-20 20:09:55 +0200 |
---|---|---|
committer | Elle Mouton <elle.mouton@gmail.com> | 2020-10-23 14:14:57 +0200 |
commit | 9d4b4b2c2c49774523de740d6492ee5b1ee15e74 (patch) | |
tree | 017771d3a7b54af87ceccc1003234f3b940f889d /src/txmempool.h | |
parent | 88271184e82222f556d67511cc64230b0532f40d (diff) |
refactor: Avoid double to int cast for nCheckFrequency
Use a ratio instead of a frequency that requires a double to int cast
for determining how often a mempool sanity check should run.
Diffstat (limited to 'src/txmempool.h')
-rw-r--r-- | src/txmempool.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/txmempool.h b/src/txmempool.h index f513f14af6..38abc65c5d 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -488,7 +488,7 @@ public: class CTxMemPool { private: - uint32_t nCheckFrequency GUARDED_BY(cs); //!< Value n means that n times in 2^32 we check. + uint32_t m_check_ratio GUARDED_BY(cs); //!< Value n means that 1 times in n we check. std::atomic<unsigned int> nTransactionsUpdated; //!< Used by getblocktemplate to trigger CreateNewBlock() invocation CBlockPolicyEstimator* minerPolicyEstimator; @@ -611,7 +611,7 @@ public: * check does nothing. */ void check(const CCoinsViewCache *pcoins) const; - void setSanityCheck(double dFrequency = 1.0) { LOCK(cs); nCheckFrequency = static_cast<uint32_t>(dFrequency * 4294967295.0); } + void setSanityCheck(int check_ratio = 0) { LOCK(cs); m_check_ratio = check_ratio; } // addUnchecked must updated state for all ancestors of a given transaction, // to track size/count of descendant transactions. First version of |