mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-07 19:22:17 +01:00
Remove unnecessary dependencies for bitcoin-cli
This commit removes all the unnecessary dependencies (key, core, netbase, sync, ...) from bitcoin-cli. To do this it shards the chain parameters into BaseParams, which contains just the RPC port and data directory (as used by utils and bitcoin-cli) and Params, with the rest.
This commit is contained in:
12
src/util.cpp
12
src/util.cpp
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include "chainparams.h"
|
||||
#include "chainparamsbase.h"
|
||||
#include "sync.h"
|
||||
#include "ui_interface.h"
|
||||
#include "uint256.h"
|
||||
@@ -918,7 +918,7 @@ boost::filesystem::path GetDefaultDataDir()
|
||||
#endif
|
||||
}
|
||||
|
||||
static boost::filesystem::path pathCached[CChainParams::MAX_NETWORK_TYPES+1];
|
||||
static boost::filesystem::path pathCached[CBaseChainParams::MAX_NETWORK_TYPES+1];
|
||||
static CCriticalSection csPathCached;
|
||||
|
||||
const boost::filesystem::path &GetDataDir(bool fNetSpecific)
|
||||
@@ -927,8 +927,8 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific)
|
||||
|
||||
LOCK(csPathCached);
|
||||
|
||||
int nNet = CChainParams::MAX_NETWORK_TYPES;
|
||||
if (fNetSpecific) nNet = Params().NetworkID();
|
||||
int nNet = CBaseChainParams::MAX_NETWORK_TYPES;
|
||||
if (fNetSpecific) nNet = BaseParams().NetworkID();
|
||||
|
||||
fs::path &path = pathCached[nNet];
|
||||
|
||||
@@ -947,7 +947,7 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific)
|
||||
path = GetDefaultDataDir();
|
||||
}
|
||||
if (fNetSpecific)
|
||||
path /= Params().DataDir();
|
||||
path /= BaseParams().DataDir();
|
||||
|
||||
fs::create_directories(path);
|
||||
|
||||
@@ -956,7 +956,7 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific)
|
||||
|
||||
void ClearDatadirCache()
|
||||
{
|
||||
std::fill(&pathCached[0], &pathCached[CChainParams::MAX_NETWORK_TYPES+1],
|
||||
std::fill(&pathCached[0], &pathCached[CBaseChainParams::MAX_NETWORK_TYPES+1],
|
||||
boost::filesystem::path());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user