Bitcoin ABC  0.24.7
P2P Digital Currency
config.cpp
Go to the documentation of this file.
1 // Copyright (c) 2017-2019 The Bitcoin developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include <config.h>
6 
7 #include <chainparams.h>
8 #include <consensus/consensus.h> // DEFAULT_MAX_BLOCK_SIZE
9 
11  : useCashAddr(false), nMaxBlockSize(DEFAULT_MAX_BLOCK_SIZE) {}
12 
13 bool GlobalConfig::SetMaxBlockSize(uint64_t maxBlockSize) {
14  // Do not allow maxBlockSize to be set below historic 1MB limit
15  // It cannot be equal either because of the "must be big" UAHF rule.
16  if (maxBlockSize <= LEGACY_MAX_BLOCK_SIZE) {
17  return false;
18  }
19 
20  nMaxBlockSize = maxBlockSize;
21  return true;
22 }
23 
25  return nMaxBlockSize;
26 }
27 
29  return Params();
30 }
31 
33 
34 const Config &GetConfig() {
35  return gConfig;
36 }
37 
39  useCashAddr = c;
40 }
42  return useCashAddr;
43 }
44 
46  : chainParams(CreateChainParams(CBaseChainParams::REGTEST)) {}
47 
48 DummyConfig::DummyConfig(std::string net)
49  : chainParams(CreateChainParams(net)) {}
50 
51 DummyConfig::DummyConfig(std::unique_ptr<CChainParams> chainParamsIn)
52  : chainParams(std::move(chainParamsIn)) {}
53 
54 void DummyConfig::SetChainParams(std::string net) {
56 }
57 
59  excessUTXOCharge = fee;
60 }
61 
63  return excessUTXOCharge;
64 }
DummyConfig::DummyConfig
DummyConfig()
Definition: config.cpp:45
CChainParams
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
Definition: chainparams.h:47
GlobalConfig::SetMaxBlockSize
bool SetMaxBlockSize(uint64_t maxBlockSize) override
Definition: config.cpp:13
chainparams.h
DummyConfig::SetChainParams
void SetChainParams(std::string net)
Definition: config.cpp:54
CBaseChainParams
CBaseChainParams defines the base parameters (shared between bitcoin-cli and bitcoind) of a given ins...
Definition: chainparamsbase.h:18
GlobalConfig::excessUTXOCharge
Amount excessUTXOCharge
Definition: config.h:47
Config
Definition: config.h:17
GlobalConfig::SetCashAddrEncoding
void SetCashAddrEncoding(bool) override
Definition: config.cpp:38
CreateChainParams
std::unique_ptr< CChainParams > CreateChainParams(const std::string &chain)
Creates and returns a std::unique_ptr<CChainParams> of the chosen chain.
Definition: chainparams.cpp:513
GlobalConfig::UseCashAddrEncoding
bool UseCashAddrEncoding() const override
Definition: config.cpp:41
consensus.h
DEFAULT_MAX_BLOCK_SIZE
static const uint64_t DEFAULT_MAX_BLOCK_SIZE
Default setting for maximum allowed size for a block, in bytes.
Definition: consensus.h:20
GlobalConfig::GlobalConfig
GlobalConfig()
Definition: config.cpp:10
GlobalConfig::SetExcessUTXOCharge
void SetExcessUTXOCharge(Amount) override
Definition: config.cpp:58
Amount
Definition: amount.h:19
LEGACY_MAX_BLOCK_SIZE
static const uint64_t LEGACY_MAX_BLOCK_SIZE
The maximum allowed size for a block, before the UAHF.
Definition: consensus.h:18
GlobalConfig::GetChainParams
const CChainParams & GetChainParams() const override
Definition: config.cpp:28
DummyConfig::chainParams
std::unique_ptr< CChainParams > chainParams
Definition: config.h:72
Params
const CChainParams & Params()
Return the currently selected parameters.
Definition: chainparams.cpp:508
gConfig
static GlobalConfig gConfig
Definition: config.cpp:32
GlobalConfig::nMaxBlockSize
uint64_t nMaxBlockSize
The largest block size this node will accept.
Definition: config.h:50
config.h
GlobalConfig::useCashAddr
bool useCashAddr
Definition: config.h:46
GlobalConfig::GetExcessUTXOCharge
Amount GetExcessUTXOCharge() const override
Definition: config.cpp:62
GetConfig
const Config & GetConfig()
Definition: config.cpp:34
GlobalConfig
Definition: config.h:33
GlobalConfig::GetMaxBlockSize
uint64_t GetMaxBlockSize() const override
Definition: config.cpp:24