aboutsummaryrefslogtreecommitdiff
path: root/src/policy/fees.h
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2022-02-21 17:03:27 +0100
committerVasil Dimov <vd@FreeBSD.org>2022-04-18 10:40:05 +0200
commite7a5bf6be79e341e037305a4c2d8a1a510a8d709 (patch)
tree4c0769152549886a8e215b12c93191701e37ef91 /src/policy/fees.h
parent2074d7df20ebc100db6a7b2c3b784ef0bdb8753f (diff)
downloadbitcoin-e7a5bf6be79e341e037305a4c2d8a1a510a8d709.tar.xz
fees: make the class FeeFilterRounder thread-safe
So that its methods can be called concurrently by different threads on the same object. Currently it has just one method (`round()`). Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
Diffstat (limited to 'src/policy/fees.h')
-rw-r--r--src/policy/fees.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/policy/fees.h b/src/policy/fees.h
index 6e25bb42b8..c7fa1a0b77 100644
--- a/src/policy/fees.h
+++ b/src/policy/fees.h
@@ -299,12 +299,13 @@ public:
/** Create new FeeFilterRounder */
explicit FeeFilterRounder(const CFeeRate& minIncrementalFee);
- /** Quantize a minimum fee for privacy purpose before broadcast. Not thread-safe due to use of FastRandomContext */
+ /** Quantize a minimum fee for privacy purpose before broadcast. */
CAmount round(CAmount currentMinFee);
private:
std::set<double> feeset;
- FastRandomContext insecure_rand;
+ Mutex m_insecure_rand_mutex;
+ FastRandomContext insecure_rand GUARDED_BY(m_insecure_rand_mutex);
};
#endif // BITCOIN_POLICY_FEES_H