Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F10615363
config.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
config.h
View Options
// Copyright (c) 2017 Amaury SÉCHET
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_CONFIG_H
#define BITCOIN_CONFIG_H
#include
<amount.h>
#include
<feerate.h>
#include
<boost/noncopyable.hpp>
#include
<cstdint>
#include
<memory>
#include
<string>
class
CChainParams
;
class
Config
:
public
boost
::
noncopyable
{
public
:
virtual
bool
SetMaxBlockSize
(
uint64_t
maxBlockSize
)
=
0
;
virtual
uint64_t
GetMaxBlockSize
()
const
=
0
;
virtual
const
CChainParams
&
GetChainParams
()
const
=
0
;
virtual
void
SetCashAddrEncoding
(
bool
)
=
0
;
virtual
bool
UseCashAddrEncoding
()
const
=
0
;
virtual
void
SetExcessUTXOCharge
(
Amount
amt
)
=
0
;
virtual
Amount
GetExcessUTXOCharge
()
const
=
0
;
};
class
GlobalConfig
final
:
public
Config
{
public
:
GlobalConfig
();
bool
SetMaxBlockSize
(
uint64_t
maxBlockSize
)
override
;
uint64_t
GetMaxBlockSize
()
const
override
;
const
CChainParams
&
GetChainParams
()
const
override
;
void
SetCashAddrEncoding
(
bool
)
override
;
bool
UseCashAddrEncoding
()
const
override
;
void
SetExcessUTXOCharge
(
Amount
)
override
;
Amount
GetExcessUTXOCharge
()
const
override
;
private
:
bool
useCashAddr
;
Amount
excessUTXOCharge
;
/** The largest block size this node will accept. */
uint64_t
nMaxBlockSize
;
};
// Dummy for subclassing in unittests
class
DummyConfig
:
public
Config
{
public
:
DummyConfig
();
explicit
DummyConfig
(
std
::
string
net
);
explicit
DummyConfig
(
std
::
unique_ptr
<
CChainParams
>
chainParamsIn
);
bool
SetMaxBlockSize
(
uint64_t
maxBlockSize
)
override
{
return
false
;
}
uint64_t
GetMaxBlockSize
()
const
override
{
return
0
;
}
void
SetChainParams
(
std
::
string
net
);
const
CChainParams
&
GetChainParams
()
const
override
{
return
*
chainParams
;
}
void
SetCashAddrEncoding
(
bool
)
override
{}
bool
UseCashAddrEncoding
()
const
override
{
return
false
;
}
void
SetExcessUTXOCharge
(
Amount
amt
)
override
{}
Amount
GetExcessUTXOCharge
()
const
override
{
return
Amount
::
zero
();
}
private
:
std
::
unique_ptr
<
CChainParams
>
chainParams
;
};
// Temporary woraround.
const
Config
&
GetConfig
();
#endif
// BITCOIN_CONFIG_H
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Sat, Nov 23, 10:05 (1 d, 5 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4515712
Default Alt Text
config.h (2 KB)
Attached To
rSTAGING Bitcoin ABC staging
Event Timeline
Log In to Comment