Bitcoin ABC  0.28.12
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 <uint256.h>
11 
12 #include <map>
13 #include <string>
14 #include <vector>
15 
16 class CFeeRate;
17 
18 // Minimum and Maximum values for tracking feerates
19 static constexpr Amount MIN_FEERATE(10 * SATOSHI);
20 static const Amount MAX_FEERATE(int64_t(1e7) * SATOSHI);
21 
22 // We have to lump transactions into buckets based on feerate, but we want to be
23 // able to give accurate estimates over a large range of potential feerates.
24 // Therefore it makes sense to exponentially space the buckets
26 static const double FEE_SPACING = 1.1;
27 
29 public:
31  explicit FeeFilterRounder(const CFeeRate &minIncrementalFee);
32 
37  Amount round(const Amount currentMinFee);
38 
39 private:
40  std::set<Amount> feeset;
42 };
43 
44 #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
FastRandomContext insecure_rand
Definition: fees.h:41
std::set< Amount > feeset
Definition: fees.h:40
FeeFilterRounder(const CFeeRate &minIncrementalFee)
Create new FeeFilterRounder.
Definition: fees.cpp:11
Amount round(const Amount currentMinFee)
Quantize a minimum fee for privacy purpose before broadcast.
Definition: fees.cpp:21
static constexpr Amount MIN_FEERATE(10 *SATOSHI)
static const double FEE_SPACING
Spacing of FeeRate buckets.
Definition: fees.h:26
static const Amount MAX_FEERATE(int64_t(1e7) *SATOSHI)
Definition: amount.h:19