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

View File

@ -35,7 +35,15 @@ namespace interface {
class Handler;
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
{
public:
@ -204,6 +212,9 @@ public:
//! Return interfaces for accessing wallets (if any).
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.
using InitMessageFn = std::function<void(const std::string& message)>;
virtual std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) = 0;

View File

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

View File

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