aboutsummaryrefslogtreecommitdiff
path: root/src/interface/node.cpp
diff options
context:
space:
mode:
authorRussell Yanofsky <[email protected]>2017-04-17 13:55:43 -0400
committerJohn Newbery <[email protected]>2018-04-04 16:52:37 -0400
commit71e0d90876efd11e2a4aeb8f3f806c5a1fd54b42 (patch)
treeaef29169f36cb553e07ab75f27dbe87100ef0748 /src/interface/node.cpp
parentAdd src/interface/README.md (diff)
downloaddiscoin-71e0d90876efd11e2a4aeb8f3f806c5a1fd54b42.tar.xz
discoin-71e0d90876efd11e2a4aeb8f3f806c5a1fd54b42.zip
Remove direct bitcoin calls from qt/bitcoin.cpp
Diffstat (limited to 'src/interface/node.cpp')
-rw-r--r--src/interface/node.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/interface/node.cpp b/src/interface/node.cpp
new file mode 100644
index 000000000..4e3fa6ceb
--- /dev/null
+++ b/src/interface/node.cpp
@@ -0,0 +1,53 @@
+// Copyright (c) 2018 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#include <interface/node.h>
+
+#include <chainparams.h>
+#include <init.h>
+#include <interface/handler.h>
+#include <scheduler.h>
+#include <ui_interface.h>
+#include <util.h>
+#include <warnings.h>
+
+#include <boost/thread/thread.hpp>
+
+namespace interface {
+namespace {
+
+class NodeImpl : public Node
+{
+ void parseParameters(int argc, const char* const argv[]) override
+ {
+ gArgs.ParseParameters(argc, argv);
+ }
+ void readConfigFile(const std::string& conf_path) override { gArgs.ReadConfigFile(conf_path); }
+ void selectParams(const std::string& network) override { SelectParams(network); }
+ void initLogging() override { InitLogging(); }
+ void initParameterInteraction() override { InitParameterInteraction(); }
+ std::string getWarnings(const std::string& type) override { return GetWarnings(type); }
+ bool baseInitialize() override
+ {
+ return AppInitBasicSetup() && AppInitParameterInteraction() && AppInitSanityChecks() &&
+ AppInitLockDataDirectory();
+ }
+ bool appInitMain() override { return AppInitMain(); }
+ void appShutdown() override
+ {
+ Interrupt();
+ Shutdown();
+ }
+ void startShutdown() override { StartShutdown(); }
+ std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) override
+ {
+ return MakeHandler(::uiInterface.InitMessage.connect(fn));
+ }
+};
+
+} // namespace
+
+std::unique_ptr<Node> MakeNode() { return MakeUnique<NodeImpl>(); }
+
+} // namespace interface