interface/qt: Remove direct src/evo calls

Refactored into interface::Node::EVO
This commit is contained in:
xdustinface 2020-08-28 02:50:50 +02:00
parent 3139459c71
commit 6c900725c2
4 changed files with 27 additions and 3 deletions

View File

@ -8,6 +8,7 @@
#include <amount.h> #include <amount.h>
#include <chain.h> #include <chain.h>
#include <chainparams.h> #include <chainparams.h>
#include <evo/deterministicmns.h>
#include <init.h> #include <init.h>
#include <interface/handler.h> #include <interface/handler.h>
#include <interface/wallet.h> #include <interface/wallet.h>
@ -46,8 +47,19 @@
namespace interface { namespace interface {
namespace { namespace {
class EVOImpl : public EVO
{
public:
CDeterministicMNList getListAtChainTip() override
{
return deterministicMNManager->GetListAtChainTip();
}
};
class NodeImpl : public Node class NodeImpl : public Node
{ {
EVOImpl m_evo;
void parseParameters(int argc, const char* const argv[]) override void parseParameters(int argc, const char* const argv[]) override
{ {
gArgs.ParseParameters(argc, argv); gArgs.ParseParameters(argc, argv);
@ -255,6 +267,8 @@ class NodeImpl : public Node
throw std::logic_error("Node::getWallets() called in non-wallet build."); throw std::logic_error("Node::getWallets() called in non-wallet build.");
#endif #endif
} }
EVO& evo() override { return m_evo; }
std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) override std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) override
{ {
return MakeHandler(::uiInterface.InitMessage.connect(fn)); return MakeHandler(::uiInterface.InitMessage.connect(fn));

View File

@ -35,7 +35,15 @@ namespace interface {
class Handler; class Handler;
class Wallet; class Wallet;
//! Top-level interface for a bitcoin node (bitcoind process). //! Interface for the src/evo part of a dash node (dashd process).
class EVO
{
public:
virtual ~EVO() {}
virtual CDeterministicMNList getListAtChainTip() = 0;
};
//! Top-level interface for a dash node (dashd process).
class Node class Node
{ {
public: public:
@ -204,6 +212,9 @@ public:
//! Return interfaces for accessing wallets (if any). //! Return interfaces for accessing wallets (if any).
virtual std::vector<std::unique_ptr<Wallet>> getWallets() = 0; virtual std::vector<std::unique_ptr<Wallet>> getWallets() = 0;
//! Return interface for accessing evo related handler.
virtual EVO& evo() = 0;
//! Register handler for init messages. //! Register handler for init messages.
using InitMessageFn = std::function<void(const std::string& message)>; using InitMessageFn = std::function<void(const std::string& message)>;
virtual std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) = 0; virtual std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) = 0;

View File

@ -95,7 +95,7 @@ CDeterministicMNList ClientModel::getMasternodeList() const
void ClientModel::refreshMasternodeList() void ClientModel::refreshMasternodeList()
{ {
LOCK(cs_mnlinst); LOCK(cs_mnlinst);
setMasternodeList(deterministicMNManager->GetListAtChainTip()); setMasternodeList(m_node.evo().getListAtChainTip());
} }
int ClientModel::getHeaderTipHeight() const int ClientModel::getHeaderTipHeight() const

View File

@ -16,7 +16,6 @@
#include <univalue.h> #include <univalue.h>
#include <util.h> #include <util.h>
#include <evo/deterministicmns.h>
#include <llmq/quorums_init.h> #include <llmq/quorums_init.h>
#include <QDir> #include <QDir>