Skip to content

Commit

Permalink
Fix Issues while compile wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
nnian committed Jun 4, 2018
1 parent 7b18203 commit 7dc24d5
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 60 deletions.
22 changes: 11 additions & 11 deletions src/CryptoNoteWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,11 @@ class RpcNode : CryptoNote::INodeObserver, public Node {
return m_node.getLastLocalBlockTimestamp();
}

uint64_t getPeerCount() {
uint64_t getPeerCount() override {
return m_node.getPeerCount();
}

uint64_t getDifficulty() {
uint64_t getDifficulty() override {
try {
CryptoNote::COMMAND_RPC_GET_INFO::request req;
CryptoNote::COMMAND_RPC_GET_INFO::response res;
Expand All @@ -221,7 +221,7 @@ class RpcNode : CryptoNote::INodeObserver, public Node {
}
}

uint64_t getTxCount() {
uint64_t getTxCount() override {
try {
CryptoNote::COMMAND_RPC_GET_INFO::request req;
CryptoNote::COMMAND_RPC_GET_INFO::response res;
Expand All @@ -243,7 +243,7 @@ class RpcNode : CryptoNote::INodeObserver, public Node {
}
}

uint64_t getTxPoolSize() {
uint64_t getTxPoolSize() override {
try {
CryptoNote::COMMAND_RPC_GET_INFO::request req;
CryptoNote::COMMAND_RPC_GET_INFO::response res;
Expand All @@ -265,7 +265,7 @@ class RpcNode : CryptoNote::INodeObserver, public Node {
}
}

uint64_t getAltBlocksCount() {
uint64_t getAltBlocksCount() override {
try {
CryptoNote::COMMAND_RPC_GET_INFO::request req;
CryptoNote::COMMAND_RPC_GET_INFO::response res;
Expand All @@ -287,7 +287,7 @@ class RpcNode : CryptoNote::INodeObserver, public Node {
}
}

uint64_t getConnectionsCount() {
uint64_t getConnectionsCount() override {
try {
CryptoNote::COMMAND_RPC_GET_INFO::request req;
CryptoNote::COMMAND_RPC_GET_INFO::response res;
Expand All @@ -309,7 +309,7 @@ class RpcNode : CryptoNote::INodeObserver, public Node {
}
}

uint64_t getOutgoingConnectionsCount() {
uint64_t getOutgoingConnectionsCount() override {
try {
CryptoNote::COMMAND_RPC_GET_INFO::request req;
CryptoNote::COMMAND_RPC_GET_INFO::response res;
Expand All @@ -331,7 +331,7 @@ class RpcNode : CryptoNote::INodeObserver, public Node {
}
}

uint64_t getIncomingConnectionsCount() {
uint64_t getIncomingConnectionsCount() override {
try {
CryptoNote::COMMAND_RPC_GET_INFO::request req;
CryptoNote::COMMAND_RPC_GET_INFO::response res;
Expand All @@ -353,7 +353,7 @@ class RpcNode : CryptoNote::INodeObserver, public Node {
}
}

uint64_t getWhitePeerlistSize() {
uint64_t getWhitePeerlistSize() override {
try {
CryptoNote::COMMAND_RPC_GET_INFO::request req;
CryptoNote::COMMAND_RPC_GET_INFO::response res;
Expand All @@ -375,7 +375,7 @@ class RpcNode : CryptoNote::INodeObserver, public Node {
}
}

uint64_t getGreyPeerlistSize() {
uint64_t getGreyPeerlistSize() override {
try {
CryptoNote::COMMAND_RPC_GET_INFO::request req;
CryptoNote::COMMAND_RPC_GET_INFO::response res;
Expand All @@ -401,7 +401,7 @@ class RpcNode : CryptoNote::INodeObserver, public Node {
return m_node.getLastLocalBlockHeaderInfo();
}

uint8_t getCurrentBlockMajorVersion() {
uint8_t getCurrentBlockMajorVersion() override {
return getLastLocalBlockHeaderInfo().majorVersion;
}

Expand Down
97 changes: 50 additions & 47 deletions src/NodeAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,11 @@ bool NodeAdapter::init() {

if(connection.compare("embedded") == 0) {

m_node = nullptr;
return initInProcessNode();
m_node = nullptr;
return initInProcessNode();

} else if(connection.compare("local") == 0) {
}
else if(connection.compare("local") == 0) {
QUrl localNodeUrl = QUrl::fromUserInput(QString("127.0.0.1:%1").arg(Settings::instance().getCurrentLocalDaemonPort()));
m_node = createRpcNode(CurrencyAdapter::instance().getCurrency(), *this, LoggerAdapter::instance().getLoggerManager(), localNodeUrl.host().toStdString(), localNodeUrl.port());
QTimer initTimer;
Expand All @@ -155,51 +156,53 @@ bool NodeAdapter::init() {
return true;
}

} else if(connection.compare("remote") == 0) {
QUrl remoteNodeUrl = QUrl::fromUserInput(Settings::instance().getCurrentRemoteNode());
m_node = createRpcNode(CurrencyAdapter::instance().getCurrency(), *this, LoggerAdapter::instance().getLoggerManager(), remoteNodeUrl.host().toStdString(), remoteNodeUrl.port());
QTimer initTimer;
initTimer.setInterval(3000);
initTimer.setSingleShot(true);
initTimer.start();
m_node->init([this](std::error_code _err) {
Q_UNUSED(_err);
});
QEventLoop waitLoop;
connect(&initTimer, &QTimer::timeout, &waitLoop, &QEventLoop::quit);
connect(this, &NodeAdapter::peerCountUpdatedSignal, &waitLoop, &QEventLoop::quit);
connect(this, &NodeAdapter::localBlockchainUpdatedSignal, &waitLoop, &QEventLoop::quit);
waitLoop.exec();
if (initTimer.isActive()) {
initTimer.stop();
Q_EMIT nodeInitCompletedSignal();
return true;
}
}
else if(connection.compare("remote") == 0) {
QUrl remoteNodeUrl = QUrl::fromUserInput(Settings::instance().getCurrentRemoteNode());
m_node = createRpcNode(CurrencyAdapter::instance().getCurrency(), *this, LoggerAdapter::instance().getLoggerManager(), remoteNodeUrl.host().toStdString(), remoteNodeUrl.port());
QTimer initTimer;
initTimer.setInterval(3000);
initTimer.setSingleShot(true);
initTimer.start();
m_node->init([this](std::error_code _err) {
Q_UNUSED(_err);
});
QEventLoop waitLoop;
connect(&initTimer, &QTimer::timeout, &waitLoop, &QEventLoop::quit);
connect(this, &NodeAdapter::peerCountUpdatedSignal, &waitLoop, &QEventLoop::quit);
connect(this, &NodeAdapter::localBlockchainUpdatedSignal, &waitLoop, &QEventLoop::quit);
waitLoop.exec();
if (initTimer.isActive()) {
initTimer.stop();
Q_EMIT nodeInitCompletedSignal();
return true;
}

} else {
QUrl localNodeUrl = QUrl::fromUserInput(QString("127.0.0.1:%1").arg(CryptoNote::RPC_DEFAULT_PORT));
m_node = createRpcNode(CurrencyAdapter::instance().getCurrency(), *this, LoggerAdapter::instance().getLoggerManager(), localNodeUrl.host().toStdString(), localNodeUrl.port());
QTimer initTimer;
initTimer.setInterval(3000);
initTimer.setSingleShot(true);
initTimer.start();
m_node->init([this](std::error_code _err) {
Q_UNUSED(_err);
});
QEventLoop waitLoop;
connect(&initTimer, &QTimer::timeout, &waitLoop, &QEventLoop::quit);
connect(this, &NodeAdapter::peerCountUpdatedSignal, &waitLoop, &QEventLoop::quit);
connect(this, &NodeAdapter::localBlockchainUpdatedSignal, &waitLoop, &QEventLoop::quit);
waitLoop.exec();
if (initTimer.isActive()) {
initTimer.stop();
Q_EMIT nodeInitCompletedSignal();
return true;
}
delete m_node;
m_node = nullptr;
return initInProcessNode();
}
}
else {
QUrl localNodeUrl = QUrl::fromUserInput(QString("127.0.0.1:%1").arg(CryptoNote::RPC_DEFAULT_PORT));
m_node = createRpcNode(CurrencyAdapter::instance().getCurrency(), *this, LoggerAdapter::instance().getLoggerManager(), localNodeUrl.host().toStdString(), localNodeUrl.port());
QTimer initTimer;
initTimer.setInterval(3000);
initTimer.setSingleShot(true);
initTimer.start();
m_node->init([this](std::error_code _err) {
Q_UNUSED(_err);
});
QEventLoop waitLoop;
connect(&initTimer, &QTimer::timeout, &waitLoop, &QEventLoop::quit);
connect(this, &NodeAdapter::peerCountUpdatedSignal, &waitLoop, &QEventLoop::quit);
connect(this, &NodeAdapter::localBlockchainUpdatedSignal, &waitLoop, &QEventLoop::quit);
waitLoop.exec();
if (initTimer.isActive()) {
initTimer.stop();
Q_EMIT nodeInitCompletedSignal();
return true;
}
delete m_node;
m_node = nullptr;
return initInProcessNode();
}

}

Expand Down
2 changes: 1 addition & 1 deletion src/WalletAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void WalletAdapter::createWallet() {
m_wallet->initAndGenerateDeterministic("");

VerifyMnemonicSeedDialog dlg(nullptr);
if (!dlg.exec() == QDialog::Accepted) {
if (dlg.exec() != QDialog::Accepted) {
return;
}
} catch (std::system_error&) {
Expand Down
2 changes: 1 addition & 1 deletion src/gui/MainWindow.mm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#import <objc/runtime.h>
#import <Cocoa/Cocoa.h>

#include "mainwindow.h"
#include "MainWindow.h"

namespace WalletGui {

Expand Down

0 comments on commit 7dc24d5

Please sign in to comment.