diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp index 85135747ff..6c529557b9 100644 --- a/src/policy/fees.cpp +++ b/src/policy/fees.cpp @@ -1,29 +1,29 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2016 The Bitcoin Core developers // Copyright (c) 2018 The Bitcoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "policy/fees.h" -#include "amount.h" -#include "feerate.h" +#include +#include +#include FeeFilterRounder::FeeFilterRounder(const CFeeRate &minIncrementalFee) { Amount minFeeLimit = std::max(SATOSHI, minIncrementalFee.GetFeePerK() / 2); feeset.insert(Amount::zero()); for (double bucketBoundary = minFeeLimit / SATOSHI; bucketBoundary <= double(MAX_FEERATE / SATOSHI); bucketBoundary *= FEE_SPACING) { feeset.insert(int64_t(bucketBoundary) * SATOSHI); } } Amount FeeFilterRounder::round(const Amount currentMinFee) { auto it = feeset.lower_bound(currentMinFee); if ((it != feeset.begin() && insecure_rand.rand32() % 3 != 0) || it == feeset.end()) { it--; } return *it; } diff --git a/src/policy/fees.h b/src/policy/fees.h index 6b65ab4b6f..b49c6dbfc3 100644 --- a/src/policy/fees.h +++ b/src/policy/fees.h @@ -1,40 +1,40 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2016 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_POLICYESTIMATOR_H #define BITCOIN_POLICYESTIMATOR_H -#include "amount.h" -#include "random.h" -#include "uint256.h" +#include +#include +#include #include #include #include class CFeeRate; // Minimum and Maximum values for tracking feerates static constexpr Amount MIN_FEERATE(10 * SATOSHI); static const Amount MAX_FEERATE(int64_t(1e7) * SATOSHI); // We have to lump transactions into buckets based on feerate, but we want to be // able to give accurate estimates over a large range of potential feerates. // Therefore it makes sense to exponentially space the buckets /** Spacing of FeeRate buckets */ static const double FEE_SPACING = 1.1; class FeeFilterRounder { public: /** Create new FeeFilterRounder */ explicit FeeFilterRounder(const CFeeRate &minIncrementalFee); /** Quantize a minimum fee for privacy purpose before broadcast **/ Amount round(const Amount currentMinFee); private: std::set feeset; FastRandomContext insecure_rand; }; #endif /*BITCOIN_POLICYESTIMATOR_H */ diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp index 0118e64844..a6bccbbcb6 100644 --- a/src/policy/policy.cpp +++ b/src/policy/policy.cpp @@ -1,155 +1,155 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2016 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. // NOTE: This file is intended to be customised by the end user, and includes // only local node policy logic -#include "policy/policy.h" +#include -#include "script/interpreter.h" -#include "tinyformat.h" -#include "util.h" -#include "utilstrencodings.h" -#include "validation.h" +#include