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" // DEFAULT_MAX_BLOCK_SIZE | #include "consensus/consensus.h" // DEFAULT_MAX_BLOCK_SIZE | ||||
#include "globals.h" | #include "globals.h" | ||||
#include "policy/policy.h" // DEFAULT_BLOCK_PRIORITY_PERCENTAGE | #include "policy/policy.h" // DEFAULT_BLOCK_PRIORITY_PERCENTAGE | ||||
#include "validation.h" // DEFAULT_TRANSACTION_MAXFEE | |||||
GlobalConfig::GlobalConfig() | GlobalConfig::GlobalConfig() | ||||
: useCashAddr(false), nMaxBlockSize(DEFAULT_MAX_BLOCK_SIZE), | : useCashAddr(false), nMaxBlockSize(DEFAULT_MAX_BLOCK_SIZE), | ||||
nBlockPriorityPercentage(DEFAULT_BLOCK_PRIORITY_PERCENTAGE) {} | nBlockPriorityPercentage(DEFAULT_BLOCK_PRIORITY_PERCENTAGE), | ||||
maxFee(DEFAULT_TRANSACTION_MAXFEE) {} | |||||
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 49 Lines • ▼ Show 20 Lines | void GlobalConfig::SetExcessUTXOCharge(Amount fee) { | ||||
excessUTXOCharge = fee; | excessUTXOCharge = fee; | ||||
} | } | ||||
Amount GlobalConfig::GetExcessUTXOCharge() const { | Amount GlobalConfig::GetExcessUTXOCharge() const { | ||||
return excessUTXOCharge; | return excessUTXOCharge; | ||||
} | } | ||||
void GlobalConfig::SetMinFeePerKB(CFeeRate fee) { | void GlobalConfig::SetMinFeePerKB(CFeeRate fee) { | ||||
feePerKB = fee; | minFeePerKB = fee; | ||||
} | } | ||||
CFeeRate GlobalConfig::GetMinFeePerKB() const { | CFeeRate GlobalConfig::GetMinFeePerKB() const { | ||||
return feePerKB; | return minFeePerKB; | ||||
} | |||||
bool GlobalConfig::SetMaxFee(Amount fee) { | |||||
if (minFeePerKB.GetFeePerK() >= fee) { | |||||
return false; | |||||
} | |||||
maxFee = fee; | |||||
return true; | |||||
} | |||||
Amount GlobalConfig::GetMaxFee() const { | |||||
return maxFee; | |||||
} | } | ||||
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) { | |||||
return false; | |||||
}; | |||||
Amount DummyConfig::GetMaxFee() const { | |||||
return DEFAULT_TRANSACTION_MAXFEE; | |||||
} |