Changeset View
Changeset View
Standalone View
Standalone View
src/config.h
Show All 22 Lines | public: | ||||
SetBlockPriorityPercentage(int64_t blockPriorityPercentage) = 0; | SetBlockPriorityPercentage(int64_t blockPriorityPercentage) = 0; | ||||
virtual uint8_t GetBlockPriorityPercentage() const = 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 SetMinFeePerKB(CFeeRate amt) = 0; | |||||
virtual CFeeRate GetMinFeePerKB() 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; | bool SetBlockPriorityPercentage(int64_t blockPriorityPercentage) override; | ||||
uint8_t GetBlockPriorityPercentage() const 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 SetMinFeePerKB(CFeeRate amt) override; | |||||
CFeeRate GetMinFeePerKB() const override; | |||||
private: | private: | ||||
bool useCashAddr; | bool useCashAddr; | ||||
Amount excessUTXOCharge; | Amount excessUTXOCharge; | ||||
CFeeRate feePerKB; | |||||
}; | }; | ||||
// 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); | ||||
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 { | bool SetBlockPriorityPercentage(int64_t blockPriorityPercentage) override { | ||||
return false; | return false; | ||||
} | } | ||||
uint8_t GetBlockPriorityPercentage() const override { return 0; } | 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 {} | ||||
Amount GetExcessUTXOCharge() const override { return Amount(0); } | Amount GetExcessUTXOCharge() const override { return Amount(0); } | ||||
void SetMinFeePerKB(CFeeRate amt) override{}; | |||||
CFeeRate GetMinFeePerKB() const override { return CFeeRate(Amount(0)); } | |||||
private: | private: | ||||
std::unique_ptr<CChainParams> chainParams; | std::unique_ptr<CChainParams> chainParams; | ||||
}; | }; | ||||
// Temporary woraround. | // Temporary woraround. | ||||
const Config &GetConfig(); | const Config &GetConfig(); | ||||
#endif | #endif |