[FWN] Start full node and listen on 8090

Not yet working, but it's progress!
This commit is contained in:
Nathan Hourt 2015-08-12 15:47:00 -04:00
parent de8ccf0ea4
commit 4906882895
4 changed files with 36 additions and 2 deletions

View file

@ -1,12 +1,18 @@
#include "BlockChain.hpp"
#include <graphene/app/application.hpp>
#include <graphene/account_history/account_history_plugin.hpp>
#include <graphene/market_history/market_history_plugin.hpp>
#include <fc/thread/thread.hpp>
#include <boost/program_options.hpp>
#include <QThread>
#include <QTimer>
#include <QDebug>
#include <QStandardPaths>
#include <QDir>
BlockChain::BlockChain()
: chainThread(fc::thread::current()),
@ -18,3 +24,26 @@ BlockChain::BlockChain()
connect(fcTaskScheduler, &QTimer::timeout, [] {fc::yield();});
fcTaskScheduler->start();
}
BlockChain::~BlockChain(){
grapheneApp->shutdown_plugins();
}
void BlockChain::start()
{
try {
grapheneApp->register_plugin<graphene::account_history::account_history_plugin>();
grapheneApp->register_plugin<graphene::market_history::market_history_plugin>();
QString dataDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
QDir(dataDir).mkpath(".");
boost::program_options::variables_map map;
map.insert({"rpc-endpoint",boost::program_options::variable_value(std::string("127.0.0.1:8090"), false)});
map.insert({"seed-node",boost::program_options::variable_value(std::vector<std::string>{("104.200.28.117:61705")}, false)});
grapheneApp->initialize(dataDir.toStdString(), map);
grapheneApp->startup();
grapheneApp->startup_plugins();
} catch (const fc::exception& e) {
elog("Crap went wrong: ${e}", ("e", e.to_detail_string()));
}
}

View file

@ -15,5 +15,8 @@ class BlockChain : public QObject {
public:
BlockChain();
virtual ~BlockChain(){}
virtual ~BlockChain();
public Q_SLOTS:
void start();
};

View file

@ -17,7 +17,7 @@ qt5_add_resources(QML_QRC qml/qml.qrc)
add_executable(full_web_node BlockChain.cpp main.cpp ${QML_QRC} ${QML})
target_link_libraries(full_web_node PRIVATE Qt5::Core Qt5::Quick Qt5::WebEngine
graphene_chain graphene_egenesis_brief graphene_utilities fc graphene_account_history graphene_market_history graphene_app )
graphene_chain graphene_egenesis_full graphene_utilities fc graphene_account_history graphene_market_history graphene_app )
install( TARGETS
full_web_node

View file

@ -7,6 +7,8 @@ Window {
width: Screen.width / 2
height: Screen.height / 2
Component.onCompleted: blockChain.start()
Rectangle { anchors.fill: parent; color: "#1F1F1F" }
WebEngineView {
anchors.fill: parent