mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-04 09:41:52 +01:00
gui: Partially revert #10244 gArgs and Params changes
Change gui code to use gArgs, Params() functions directly instead of going through interfaces::Node. Remotely accessing bitcoin-node ArgsManager from bitcoin-gui works fine in https://github.com/bitcoin/bitcoin/pull/10102, when bitcoin-gui spawns a new bitcoin-node process and controls its startup, but for bitcoin-gui to support -ipcconnect option in https://github.com/bitcoin/bitcoin/pull/19461 and connect to an existing bitcoin-node process, it needs ability to parse arguments itself before connecting out. This change also simplifies https://github.com/bitcoin/bitcoin/pull/10102 a bit, by making the bitcoin-gui -> bitcoin-node startup sequence more similar to the bitcoin-node -> bitcoin-wallet startup sequence where the parent process parses arguments and passes them to the child process instead of the parent process using the child process to parse arguments.
This commit is contained in:
@@ -57,22 +57,8 @@ class NodeImpl : public Node
|
||||
{
|
||||
public:
|
||||
NodeImpl(NodeContext* context) { setContext(context); }
|
||||
void initError(const bilingual_str& message) override { InitError(message); }
|
||||
bool parseParameters(int argc, const char* const argv[], std::string& error) override
|
||||
{
|
||||
return gArgs.ParseParameters(argc, argv, error);
|
||||
}
|
||||
bool readConfigFiles(std::string& error) override { return gArgs.ReadConfigFiles(error, true); }
|
||||
void forceSetArg(const std::string& arg, const std::string& value) override { gArgs.ForceSetArg(arg, value); }
|
||||
bool softSetArg(const std::string& arg, const std::string& value) override { return gArgs.SoftSetArg(arg, value); }
|
||||
bool softSetBoolArg(const std::string& arg, bool value) override { return gArgs.SoftSetBoolArg(arg, value); }
|
||||
void selectParams(const std::string& network) override { SelectParams(network); }
|
||||
bool initSettings(std::string& error) override { return gArgs.InitSettings(error); }
|
||||
uint64_t getAssumedBlockchainSize() override { return Params().AssumedBlockchainSize(); }
|
||||
uint64_t getAssumedChainStateSize() override { return Params().AssumedChainStateSize(); }
|
||||
std::string getNetwork() override { return Params().NetworkIDString(); }
|
||||
void initLogging() override { InitLogging(gArgs); }
|
||||
void initParameterInteraction() override { InitParameterInteraction(gArgs); }
|
||||
void initLogging() override { InitLogging(*Assert(m_context->args)); }
|
||||
void initParameterInteraction() override { InitParameterInteraction(*Assert(m_context->args)); }
|
||||
bilingual_str getWarnings() override { return GetWarnings(true); }
|
||||
uint32_t getLogCategories() override { return LogInstance().GetCategoryMask(); }
|
||||
bool baseInitialize() override
|
||||
@@ -109,7 +95,6 @@ public:
|
||||
StopMapPort();
|
||||
}
|
||||
}
|
||||
void setupServerArgs() override { return SetupServerArgs(*m_context); }
|
||||
bool getProxy(Network net, proxyType& proxy_info) override { return GetProxy(net, proxy_info); }
|
||||
size_t getNodeCount(CConnman::NumConnections flags) override
|
||||
{
|
||||
|
||||
@@ -55,41 +55,6 @@ class Node
|
||||
public:
|
||||
virtual ~Node() {}
|
||||
|
||||
//! Send init error.
|
||||
virtual void initError(const bilingual_str& message) = 0;
|
||||
|
||||
//! Set command line arguments.
|
||||
virtual bool parseParameters(int argc, const char* const argv[], std::string& error) = 0;
|
||||
|
||||
//! Set a command line argument
|
||||
virtual void forceSetArg(const std::string& arg, const std::string& value) = 0;
|
||||
|
||||
//! Set a command line argument if it doesn't already have a value
|
||||
virtual bool softSetArg(const std::string& arg, const std::string& value) = 0;
|
||||
|
||||
//! Set a command line boolean argument if it doesn't already have a value
|
||||
virtual bool softSetBoolArg(const std::string& arg, bool value) = 0;
|
||||
|
||||
//! Load settings from configuration file.
|
||||
virtual bool readConfigFiles(std::string& error) = 0;
|
||||
|
||||
//! Choose network parameters.
|
||||
virtual void selectParams(const std::string& network) = 0;
|
||||
|
||||
//! Read and update <datadir>/settings.json file with saved settings. This
|
||||
//! needs to be called after selectParams() because the settings file
|
||||
//! location is network-specific.
|
||||
virtual bool initSettings(std::string& error) = 0;
|
||||
|
||||
//! Get the (assumed) blockchain size.
|
||||
virtual uint64_t getAssumedBlockchainSize() = 0;
|
||||
|
||||
//! Get the (assumed) chain state size.
|
||||
virtual uint64_t getAssumedChainStateSize() = 0;
|
||||
|
||||
//! Get network name.
|
||||
virtual std::string getNetwork() = 0;
|
||||
|
||||
//! Init logging.
|
||||
virtual void initLogging() = 0;
|
||||
|
||||
@@ -117,9 +82,6 @@ public:
|
||||
//! Return whether shutdown was requested.
|
||||
virtual bool shutdownRequested() = 0;
|
||||
|
||||
//! Setup arguments
|
||||
virtual void setupServerArgs() = 0;
|
||||
|
||||
//! Map port.
|
||||
virtual void mapPort(bool use_upnp) = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user