Changeset View
Changeset View
Standalone View
Standalone View
src/config.h
Show All 27 Lines | public: | ||||
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 void SetMinFeePerKB(CFeeRate amt) = 0; | ||||
virtual CFeeRate GetMinFeePerKB() const = 0; | virtual CFeeRate GetMinFeePerKB() const = 0; | ||||
/** | |||||
* Absolute maximum transaction fee per kb (in satoshis) used by wallet and | |||||
* mempool | |||||
* (rejects high fee in sendrawtransaction) | |||||
*/ | |||||
virtual bool SetMaxFee(Amount amt) = 0; | |||||
virtual Amount GetMaxFee() 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; | 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; | void SetMinFeePerKB(CFeeRate amt) override; | ||||
CFeeRate GetMinFeePerKB() const override; | CFeeRate GetMinFeePerKB() const override; | ||||
bool SetMaxFee(Amount amt) override; | |||||
Amount GetMaxFee() const override; | |||||
void SetRPCUserAndPassword(std::string userAndPassword) override; | void SetRPCUserAndPassword(std::string userAndPassword) override; | ||||
std::string GetRPCUserAndPassword() const override; | std::string GetRPCUserAndPassword() const override; | ||||
void SetRPCCORSDomain(std::string corsDomain) override; | void SetRPCCORSDomain(std::string corsDomain) override; | ||||
std::string GetRPCCORSDomain() const override; | std::string GetRPCCORSDomain() const override; | ||||
private: | private: | ||||
bool useCashAddr; | bool useCashAddr; | ||||
Amount excessUTXOCharge; | Amount excessUTXOCharge; | ||||
CFeeRate feePerKB; | CFeeRate minFeePerKB; | ||||
Amount maxFee; | |||||
}; | }; | ||||
// 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; } | ||||
Show All 12 Lines | public: | ||||
void SetExcessUTXOCharge(Amount amt) override {} | void SetExcessUTXOCharge(Amount amt) override {} | ||||
Amount GetExcessUTXOCharge() const override { return Amount::zero(); } | Amount GetExcessUTXOCharge() const override { return Amount::zero(); } | ||||
void SetMinFeePerKB(CFeeRate amt) override{}; | void SetMinFeePerKB(CFeeRate amt) override{}; | ||||
CFeeRate GetMinFeePerKB() const override { | CFeeRate GetMinFeePerKB() const override { | ||||
return CFeeRate(Amount::zero()); | return CFeeRate(Amount::zero()); | ||||
} | } | ||||
bool SetMaxFee(Amount amt) override { return false; }; | |||||
Amount GetMaxFee() const override { return MAX_MONEY; } | |||||
void SetRPCUserAndPassword(std::string userAndPassword) override{}; | void SetRPCUserAndPassword(std::string userAndPassword) override{}; | ||||
std::string GetRPCUserAndPassword() const override { return ""; }; | std::string GetRPCUserAndPassword() const override { return ""; }; | ||||
void SetRPCCORSDomain(std::string corsDomain) override{}; | void SetRPCCORSDomain(std::string corsDomain) override{}; | ||||
std::string GetRPCCORSDomain() const override { return ""; }; | std::string GetRPCCORSDomain() const override { return ""; }; | ||||
private: | private: | ||||
std::unique_ptr<CChainParams> chainParams; | std::unique_ptr<CChainParams> chainParams; | ||||
}; | }; | ||||
// Temporary woraround. | // Temporary woraround. | ||||
const Config &GetConfig(); | const Config &GetConfig(); | ||||
#endif | #endif |