diff --git a/src/config.cpp b/src/config.cpp index 4c7ce267b8..d4cfba279c 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -1,96 +1,81 @@ // Copyright (c) 2017 The Bitcoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include #include #include // DEFAULT_MAX_BLOCK_SIZE #include -#include // DEFAULT_BLOCK_PRIORITY_PERCENTAGE GlobalConfig::GlobalConfig() - : useCashAddr(false), nMaxBlockSize(DEFAULT_MAX_BLOCK_SIZE), - nBlockPriorityPercentage(DEFAULT_BLOCK_PRIORITY_PERCENTAGE) {} + : useCashAddr(false), nMaxBlockSize(DEFAULT_MAX_BLOCK_SIZE) {} bool GlobalConfig::SetMaxBlockSize(uint64_t maxBlockSize) { // Do not allow maxBlockSize to be set below historic 1MB limit // It cannot be equal either because of the "must be big" UAHF rule. if (maxBlockSize <= LEGACY_MAX_BLOCK_SIZE) { return false; } nMaxBlockSize = maxBlockSize; return true; } uint64_t GlobalConfig::GetMaxBlockSize() const { return nMaxBlockSize; } -bool GlobalConfig::SetBlockPriorityPercentage(int64_t blockPriorityPercentage) { - // blockPriorityPercentage has to belong to [0..100] - if ((blockPriorityPercentage < 0) || (blockPriorityPercentage > 100)) { - return false; - } - nBlockPriorityPercentage = blockPriorityPercentage; - return true; -} - -uint8_t GlobalConfig::GetBlockPriorityPercentage() const { - return nBlockPriorityPercentage; -} - const CChainParams &GlobalConfig::GetChainParams() const { return Params(); } static GlobalConfig gConfig; const Config &GetConfig() { return gConfig; } void GlobalConfig::SetCashAddrEncoding(bool c) { useCashAddr = c; } bool GlobalConfig::UseCashAddrEncoding() const { return useCashAddr; } DummyConfig::DummyConfig() : chainParams(CreateChainParams(CBaseChainParams::REGTEST)) {} DummyConfig::DummyConfig(std::string net) : chainParams(CreateChainParams(net)) {} DummyConfig::DummyConfig(std::unique_ptr chainParamsIn) : chainParams(std::move(chainParamsIn)) {} void DummyConfig::SetChainParams(std::string net) { chainParams = CreateChainParams(net); } void GlobalConfig::SetExcessUTXOCharge(Amount fee) { excessUTXOCharge = fee; } Amount GlobalConfig::GetExcessUTXOCharge() const { return excessUTXOCharge; } void GlobalConfig::SetRPCUserAndPassword(std::string userAndPassword) { rpcUserAndPassword = userAndPassword; } std::string GlobalConfig::GetRPCUserAndPassword() const { return rpcUserAndPassword; } void GlobalConfig::SetRPCCORSDomain(std::string corsDomain) { rpcCORSDomain = corsDomain; } std::string GlobalConfig::GetRPCCORSDomain() const { return rpcCORSDomain; } diff --git a/src/config.h b/src/config.h index a9d83192c1..175efb3fce 100644 --- a/src/config.h +++ b/src/config.h @@ -1,109 +1,99 @@ // Copyright (c) 2017 Amaury SÉCHET // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CONFIG_H #define BITCOIN_CONFIG_H #include #include #include #include #include #include class CChainParams; class Config : public boost::noncopyable { public: virtual bool SetMaxBlockSize(uint64_t maxBlockSize) = 0; virtual uint64_t GetMaxBlockSize() const = 0; - virtual bool - SetBlockPriorityPercentage(int64_t blockPriorityPercentage) = 0; - virtual uint8_t GetBlockPriorityPercentage() const = 0; virtual const CChainParams &GetChainParams() const = 0; virtual void SetCashAddrEncoding(bool) = 0; virtual bool UseCashAddrEncoding() const = 0; virtual void SetExcessUTXOCharge(Amount amt) = 0; virtual Amount GetExcessUTXOCharge() const = 0; virtual void SetRPCUserAndPassword(std::string userAndPassword) = 0; virtual std::string GetRPCUserAndPassword() const = 0; virtual void SetRPCCORSDomain(std::string corsDomain) = 0; virtual std::string GetRPCCORSDomain() const = 0; }; class GlobalConfig final : public Config { public: GlobalConfig(); bool SetMaxBlockSize(uint64_t maxBlockSize) override; uint64_t GetMaxBlockSize() const override; - bool SetBlockPriorityPercentage(int64_t blockPriorityPercentage) override; - uint8_t GetBlockPriorityPercentage() const override; const CChainParams &GetChainParams() const override; void SetCashAddrEncoding(bool) override; bool UseCashAddrEncoding() const override; void SetExcessUTXOCharge(Amount) override; Amount GetExcessUTXOCharge() const override; void SetRPCUserAndPassword(std::string userAndPassword) override; std::string GetRPCUserAndPassword() const override; void SetRPCCORSDomain(std::string corsDomain) override; std::string GetRPCCORSDomain() const override; private: bool useCashAddr; Amount excessUTXOCharge; /** RPC authentication configs */ // Pre-base64-encoded authentication token, with user and password separated // by a colon. std::string rpcUserAndPassword; // CORS domain, the allowed Origin std::string rpcCORSDomain; /** The largest block size this node will accept. */ uint64_t nMaxBlockSize; - uint64_t nBlockPriorityPercentage; }; // Dummy for subclassing in unittests class DummyConfig : public Config { public: DummyConfig(); DummyConfig(std::string net); DummyConfig(std::unique_ptr chainParamsIn); bool SetMaxBlockSize(uint64_t maxBlockSize) override { return false; } uint64_t GetMaxBlockSize() const override { return 0; } - bool SetBlockPriorityPercentage(int64_t blockPriorityPercentage) override { - return false; - } - uint8_t GetBlockPriorityPercentage() const override { return 0; } void SetChainParams(std::string net); const CChainParams &GetChainParams() const override { return *chainParams; } void SetCashAddrEncoding(bool) override {} bool UseCashAddrEncoding() const override { return false; } void SetExcessUTXOCharge(Amount amt) override {} Amount GetExcessUTXOCharge() const override { return Amount::zero(); } void SetRPCUserAndPassword(std::string userAndPassword) override{}; std::string GetRPCUserAndPassword() const override { return ""; }; void SetRPCCORSDomain(std::string corsDomain) override{}; std::string GetRPCCORSDomain() const override { return ""; }; private: std::unique_ptr chainParams; }; // Temporary woraround. const Config &GetConfig(); #endif // BITCOIN_CONFIG_H diff --git a/src/init.cpp b/src/init.cpp index 153dda784f..e0355bbaae 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1,2502 +1,2488 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2018 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #if defined(HAVE_CONFIG_H) #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include