Bitcoin ABC 0.30.7
P2P Digital Currency
fees.h
Go to the documentation of this file.
1// Copyright (c) 2009-2010 Satoshi Nakamoto
2// Copyright (c) 2009-2016 The Bitcoin Core developers
3// Distributed under the MIT software license, see the accompanying
4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5#ifndef BITCOIN_POLICY_FEES_H
6#define BITCOIN_POLICY_FEES_H
7
8#include <consensus/amount.h>
9#include <random.h>
10#include <sync.h>
11#include <uint256.h>
12
13#include <map>
14#include <string>
15#include <vector>
16
17class CFeeRate;
18
19// Minimum and Maximum values for tracking feerates
20static constexpr Amount MIN_FEERATE(10 * SATOSHI);
21static const Amount MAX_FEERATE(int64_t(1e7) * SATOSHI);
22
23// We have to lump transactions into buckets based on feerate, but we want to be
24// able to give accurate estimates over a large range of potential feerates.
25// Therefore it makes sense to exponentially space the buckets
27static const double FEE_SPACING = 1.1;
28
30public:
32 explicit FeeFilterRounder(const CFeeRate &min_incremental_fee,
34
38 Amount round(const Amount currentMinFee)
40
41private:
42 const std::set<Amount> m_fee_set;
45};
46
47#endif // BITCOIN_POLICY_FEES_H
static constexpr Amount SATOSHI
Definition: amount.h:143
Fee rate in satoshis per kilobyte: Amount / kB.
Definition: feerate.h:21
Fast randomness source.
Definition: random.h:156
const std::set< Amount > m_fee_set
Definition: fees.h:42
FastRandomContext &insecure_rand GUARDED_BY(m_insecure_rand_mutex)
Amount round(const Amount currentMinFee) EXCLUSIVE_LOCKS_REQUIRED(!m_insecure_rand_mutex)
Quantize a minimum fee for privacy purpose before broadcast.
Definition: fees.cpp:33
FeeFilterRounder(const CFeeRate &min_incremental_fee, FastRandomContext &rng)
Create new FeeFilterRounder.
Definition: fees.cpp:28
Mutex m_insecure_rand_mutex
Definition: fees.h:43
static constexpr Amount MIN_FEERATE(10 *SATOSHI)
static const double FEE_SPACING
Spacing of FeeRate buckets.
Definition: fees.h:27
static const Amount MAX_FEERATE(int64_t(1e7) *SATOSHI)
Definition: amount.h:19
#define EXCLUSIVE_LOCKS_REQUIRED(...)
Definition: threadsafety.h:56