Changeset View
Changeset View
Standalone View
Standalone View
src/config.h
Show All 14 Lines | |||||
#include <string> | #include <string> | ||||
class CChainParams; | class CChainParams; | ||||
class Config : public boost::noncopyable { | class Config : public boost::noncopyable { | ||||
public: | public: | ||||
virtual bool SetMaxBlockSize(uint64_t maxBlockSize) = 0; | virtual bool SetMaxBlockSize(uint64_t maxBlockSize) = 0; | ||||
virtual uint64_t GetMaxBlockSize() const = 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 const CChainParams &GetChainParams() const = 0; | ||||
virtual void SetCashAddrEncoding(bool) = 0; | virtual void SetCashAddrEncoding(bool) = 0; | ||||
virtual bool UseCashAddrEncoding() const = 0; | virtual bool UseCashAddrEncoding() const = 0; | ||||
virtual void SetExcessUTXOCharge(Amount amt) = 0; | virtual void SetExcessUTXOCharge(Amount amt) = 0; | ||||
virtual Amount GetExcessUTXOCharge() const = 0; | virtual Amount GetExcessUTXOCharge() const = 0; | ||||
virtual void SetRPCUserAndPassword(std::string userAndPassword) = 0; | virtual void SetRPCUserAndPassword(std::string userAndPassword) = 0; | ||||
virtual std::string GetRPCUserAndPassword() const = 0; | virtual std::string GetRPCUserAndPassword() const = 0; | ||||
virtual void SetRPCCORSDomain(std::string corsDomain) = 0; | virtual void SetRPCCORSDomain(std::string corsDomain) = 0; | ||||
virtual std::string GetRPCCORSDomain() const = 0; | virtual std::string GetRPCCORSDomain() const = 0; | ||||
}; | }; | ||||
class GlobalConfig final : public Config { | class GlobalConfig final : public Config { | ||||
public: | public: | ||||
GlobalConfig(); | GlobalConfig(); | ||||
bool SetMaxBlockSize(uint64_t maxBlockSize) override; | bool SetMaxBlockSize(uint64_t maxBlockSize) override; | ||||
uint64_t GetMaxBlockSize() const override; | uint64_t GetMaxBlockSize() const override; | ||||
bool SetBlockPriorityPercentage(int64_t blockPriorityPercentage) override; | |||||
uint8_t GetBlockPriorityPercentage() const override; | |||||
const CChainParams &GetChainParams() const override; | const CChainParams &GetChainParams() const override; | ||||
void SetCashAddrEncoding(bool) override; | void SetCashAddrEncoding(bool) override; | ||||
bool UseCashAddrEncoding() const override; | bool UseCashAddrEncoding() const override; | ||||
void SetExcessUTXOCharge(Amount) override; | void SetExcessUTXOCharge(Amount) override; | ||||
Amount GetExcessUTXOCharge() const override; | Amount GetExcessUTXOCharge() const override; | ||||
void SetRPCUserAndPassword(std::string userAndPassword) override; | void SetRPCUserAndPassword(std::string userAndPassword) override; | ||||
Show All 10 Lines | private: | ||||
// Pre-base64-encoded authentication token, with user and password separated | // Pre-base64-encoded authentication token, with user and password separated | ||||
// by a colon. | // by a colon. | ||||
std::string rpcUserAndPassword; | std::string rpcUserAndPassword; | ||||
// CORS domain, the allowed Origin | // CORS domain, the allowed Origin | ||||
std::string rpcCORSDomain; | std::string rpcCORSDomain; | ||||
/** The largest block size this node will accept. */ | /** The largest block size this node will accept. */ | ||||
uint64_t nMaxBlockSize; | uint64_t nMaxBlockSize; | ||||
uint64_t nBlockPriorityPercentage; | |||||
}; | }; | ||||
// Dummy for subclassing in unittests | // Dummy for subclassing in unittests | ||||
class DummyConfig : public Config { | class DummyConfig : public Config { | ||||
public: | public: | ||||
DummyConfig(); | DummyConfig(); | ||||
DummyConfig(std::string net); | DummyConfig(std::string net); | ||||
DummyConfig(std::unique_ptr<CChainParams> chainParamsIn); | DummyConfig(std::unique_ptr<CChainParams> chainParamsIn); | ||||
bool SetMaxBlockSize(uint64_t maxBlockSize) override { return false; } | bool SetMaxBlockSize(uint64_t maxBlockSize) override { return false; } | ||||
uint64_t GetMaxBlockSize() const override { return 0; } | 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); | void SetChainParams(std::string net); | ||||
const CChainParams &GetChainParams() const override { return *chainParams; } | const CChainParams &GetChainParams() const override { return *chainParams; } | ||||
void SetCashAddrEncoding(bool) override {} | void SetCashAddrEncoding(bool) override {} | ||||
bool UseCashAddrEncoding() const override { return false; } | bool UseCashAddrEncoding() const override { return false; } | ||||
void SetExcessUTXOCharge(Amount amt) override {} | void SetExcessUTXOCharge(Amount amt) override {} | ||||
Show All 15 Lines |