Changeset View
Changeset View
Standalone View
Standalone View
src/config.cpp
// Copyright (c) 2017 The Bitcoin developers | // Copyright (c) 2017 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include "config.h" | #include "config.h" | ||||
#include "chainparams.h" | #include "chainparams.h" | ||||
#include "consensus/consensus.h" | #include "consensus/consensus.h" | ||||
#include "globals.h" | #include "globals.h" | ||||
#include "validation.h" | #include "validation.h" | ||||
GlobalConfig::GlobalConfig() | GlobalConfig::GlobalConfig() | ||||
: useCashAddr(false), maxFee(DEFAULT_TRANSACTION_MAXFEE) {} | : useCashAddr(false), maxFeePerKB(DEFAULT_TRANSACTION_MAXFEE_PER_KB) {} | ||||
bool GlobalConfig::SetMaxBlockSize(uint64_t maxBlockSize) { | bool GlobalConfig::SetMaxBlockSize(uint64_t maxBlockSize) { | ||||
// Do not allow maxBlockSize to be set below historic 1MB limit | // Do not allow maxBlockSize to be set below historic 1MB limit | ||||
// It cannot be equal either because of the "must be big" UAHF rule. | // It cannot be equal either because of the "must be big" UAHF rule. | ||||
if (maxBlockSize <= LEGACY_MAX_BLOCK_SIZE) { | if (maxBlockSize <= LEGACY_MAX_BLOCK_SIZE) { | ||||
return false; | return false; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
void GlobalConfig::SetMinFeePerKB(CFeeRate fee) { | void GlobalConfig::SetMinFeePerKB(CFeeRate fee) { | ||||
minFeePerKB = fee; | minFeePerKB = fee; | ||||
} | } | ||||
CFeeRate GlobalConfig::GetMinFeePerKB() const { | CFeeRate GlobalConfig::GetMinFeePerKB() const { | ||||
return minFeePerKB; | return minFeePerKB; | ||||
} | } | ||||
bool GlobalConfig::SetMaxFee(Amount fee) { | bool GlobalConfig::SetMaxFeePerKB(CFeeRate fee) { | ||||
if (minFeePerKB.GetFeePerK() >= fee) { | if (minFeePerKB >= fee) { | ||||
return false; | return false; | ||||
} | } | ||||
maxFee = fee; | maxFeePerKB = fee; | ||||
return true; | return true; | ||||
} | } | ||||
Amount GlobalConfig::GetMaxFee() const { | CFeeRate GlobalConfig::GetMaxFeePerKB() const { | ||||
return maxFee; | return maxFeePerKB; | ||||
} | } | ||||
void GlobalConfig::SetRPCUserAndPassword(std::string userAndPassword) { | void GlobalConfig::SetRPCUserAndPassword(std::string userAndPassword) { | ||||
rpcUserAndPassword = userAndPassword; | rpcUserAndPassword = userAndPassword; | ||||
} | } | ||||
std::string GlobalConfig::GetRPCUserAndPassword() const { | std::string GlobalConfig::GetRPCUserAndPassword() const { | ||||
return rpcUserAndPassword; | return rpcUserAndPassword; | ||||
} | } | ||||
void GlobalConfig::SetRPCCORSDomain(std::string corsDomain) { | void GlobalConfig::SetRPCCORSDomain(std::string corsDomain) { | ||||
rpcCORSDomain = corsDomain; | rpcCORSDomain = corsDomain; | ||||
} | } | ||||
std::string GlobalConfig::GetRPCCORSDomain() const { | std::string GlobalConfig::GetRPCCORSDomain() const { | ||||
return rpcCORSDomain; | return rpcCORSDomain; | ||||
} | } | ||||
bool DummyConfig::SetMaxFee(Amount amt) { | bool DummyConfig::SetMaxFeePerKB(CFeeRate amt) { | ||||
return false; | return false; | ||||
}; | }; | ||||
Amount DummyConfig::GetMaxFee() const { | CFeeRate DummyConfig::GetMaxFeePerKB() const { | ||||
return DEFAULT_TRANSACTION_MAXFEE; | return CFeeRate(DEFAULT_TRANSACTION_MAXFEE_PER_KB); | ||||
} | } |