Skip to content

Commit 2dacfb0

Browse files
Merge dashpay#5980: refactor: move C{ActiveMasternode, DeterministicMN}Manager, CMasternode{MetaMan, Sync} to NodeContext
a5be37c refactor: remove CDeterministicMNManager global, move to NodeContext (Kittywhiskers Van Gogh) cf90cf2 refactor: remove CMasternodeMetaMan global, move to NodeContext (Kittywhiskers Van Gogh) 81b1247 refactor: remove CActiveMasternodeManager global, move to NodeContext (Kittywhiskers Van Gogh) c99fb42 refactor: remove CMasternodeSync global, move to NodeContext (Kittywhiskers Van Gogh) a247a63 refactor: make CTxMemPool ProTx paths conditional on CDeterministicMNManager presence (Kittywhiskers Van Gogh) Pull request description: ## Additional Information * Depends on dashpay#5966 * `CTxMemPool`'s ProTx logic took the presence of `CDeterministicMNManager` for granted. To account for `CTxMemPool` instances that aren't seeded with the pointer to the manager (usually because the unit test doesn't call for them), refactoring was done to make ProTx code paths conditional on the manager pointer being set to something. * Setting the manager pointer is done through `CTxMemPool::Init()`, to avoid having to pass another `std::unique_ptr` const-ref and also because `CTxMemPool` can _technically_ work without the manager if ProTx logic is not needed (and `CTxMemPool::existsProviderTxConflict()` isn't called) * `CTxMemPool::Init()` doesn't allow overwriting a not-`nullptr` manager pointer. If that is desired, then `CTxMemPool::Reset()` should be called first. This was done to avoid unintentional double-initialization/overwriting. ## Breaking Changes None. Changes are limited to refactoring. ## Checklist: - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have added or updated relevant unit/integration/functional/e2e tests - [x] I have made corresponding changes to the documentation **(note: N/A)** - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: PastaPastaPasta: utACK a5be37c Tree-SHA512: 8dc7ada6597a265b7753603bca6a43b69cfe3b0d330bae98c3e27b6aa24cd3cdff80f6939bb39ffc00902b76b6b145667f0b7ac98a17fe8255d6fd143088a98c
2 parents 44d9ac7 + a5be37c commit 2dacfb0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+446
-327
lines changed

src/coinjoin/client.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ PeerMsgRet CCoinJoinClientQueueManager::ProcessMessage(const CNode& peer, std::s
4242

4343
PeerMsgRet CCoinJoinClientQueueManager::ProcessDSQueue(const CNode& peer, CDataStream& vRecv)
4444
{
45-
assert(::mmetaman->IsValid());
45+
assert(m_mn_metaman.IsValid());
4646

4747
CCoinJoinQueue dsq;
4848
vRecv >> dsq;
@@ -105,18 +105,18 @@ PeerMsgRet CCoinJoinClientQueueManager::ProcessDSQueue(const CNode& peer, CDataS
105105
dmn->pdmnState->addr.ToString());
106106
return {};
107107
} else {
108-
int64_t nLastDsq = mmetaman->GetMetaInfo(dmn->proTxHash)->GetLastDsq();
109-
int64_t nDsqThreshold = mmetaman->GetDsqThreshold(dmn->proTxHash, tip_mn_list.GetValidMNsCount());
108+
int64_t nLastDsq = m_mn_metaman.GetMetaInfo(dmn->proTxHash)->GetLastDsq();
109+
int64_t nDsqThreshold = m_mn_metaman.GetDsqThreshold(dmn->proTxHash, tip_mn_list.GetValidMNsCount());
110110
LogPrint(BCLog::COINJOIN, "DSQUEUE -- nLastDsq: %d nDsqThreshold: %d nDsqCount: %d\n", nLastDsq,
111-
nDsqThreshold, mmetaman->GetDsqCount());
111+
nDsqThreshold, m_mn_metaman.GetDsqCount());
112112
// don't allow a few nodes to dominate the queuing process
113-
if (nLastDsq != 0 && nDsqThreshold > mmetaman->GetDsqCount()) {
113+
if (nLastDsq != 0 && nDsqThreshold > m_mn_metaman.GetDsqCount()) {
114114
LogPrint(BCLog::COINJOIN, "DSQUEUE -- Masternode %s is sending too many dsq messages\n",
115115
dmn->proTxHash.ToString());
116116
return {};
117117
}
118118

119-
mmetaman->AllowMixing(dmn->proTxHash);
119+
m_mn_metaman.AllowMixing(dmn->proTxHash);
120120

121121
LogPrint(BCLog::COINJOIN, "DSQUEUE -- new CoinJoin queue (%s) from masternode %s\n", dsq.ToString(),
122122
dmn->pdmnState->addr.ToString());
@@ -155,12 +155,13 @@ void CCoinJoinClientManager::ProcessMessage(CNode& peer, CConnman& connman, cons
155155
}
156156
}
157157

158-
CCoinJoinClientSession::CCoinJoinClientSession(CWallet& wallet, CoinJoinWalletManager& walletman, CDeterministicMNManager& dmnman, const CMasternodeSync& mn_sync,
159-
const std::unique_ptr<CCoinJoinClientQueueManager>& queueman) :
158+
CCoinJoinClientSession::CCoinJoinClientSession(CWallet& wallet, CoinJoinWalletManager& walletman, CDeterministicMNManager& dmnman, CMasternodeMetaMan& mn_metaman,
159+
const CMasternodeSync& mn_sync, const std::unique_ptr<CCoinJoinClientQueueManager>& queueman) :
160160
m_wallet(wallet),
161161
m_walletman(walletman),
162162
m_manager(*Assert(walletman.Get(wallet.GetName()))),
163163
m_dmnman(dmnman),
164+
m_mn_metaman(mn_metaman),
164165
m_mn_sync(mn_sync),
165166
m_queueman(queueman)
166167
{}
@@ -990,7 +991,7 @@ bool CCoinJoinClientManager::DoAutomaticDenominating(CConnman& connman, CTxMemPo
990991
AssertLockNotHeld(cs_deqsessions);
991992
LOCK(cs_deqsessions);
992993
if (int(deqSessions.size()) < CCoinJoinClientOptions::GetSessions()) {
993-
deqSessions.emplace_back(m_wallet, m_walletman, m_dmnman, m_mn_sync, m_queueman);
994+
deqSessions.emplace_back(m_wallet, m_walletman, m_dmnman, m_mn_metaman, m_mn_sync, m_queueman);
994995
}
995996
for (auto& session : deqSessions) {
996997
if (!CheckAutomaticBackup()) return false;
@@ -1119,7 +1120,7 @@ bool CCoinJoinClientSession::JoinExistingQueue(CAmount nBalanceNeedsAnonymized,
11191120

11201121
bool CCoinJoinClientSession::StartNewQueue(CAmount nBalanceNeedsAnonymized, CConnman& connman)
11211122
{
1122-
assert(::mmetaman->IsValid());
1123+
assert(m_mn_metaman.IsValid());
11231124

11241125
if (!CCoinJoinClientOptions::IsEnabled()) return false;
11251126
if (nBalanceNeedsAnonymized <= 0) return false;
@@ -1156,13 +1157,13 @@ bool CCoinJoinClientSession::StartNewQueue(CAmount nBalanceNeedsAnonymized, CCon
11561157
continue;
11571158
}
11581159

1159-
int64_t nLastDsq = mmetaman->GetMetaInfo(dmn->proTxHash)->GetLastDsq();
1160-
int64_t nDsqThreshold = mmetaman->GetDsqThreshold(dmn->proTxHash, nMnCount);
1161-
if (nLastDsq != 0 && nDsqThreshold > mmetaman->GetDsqCount()) {
1160+
int64_t nLastDsq = m_mn_metaman.GetMetaInfo(dmn->proTxHash)->GetLastDsq();
1161+
int64_t nDsqThreshold = m_mn_metaman.GetDsqThreshold(dmn->proTxHash, nMnCount);
1162+
if (nLastDsq != 0 && nDsqThreshold > m_mn_metaman.GetDsqCount()) {
11621163
WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::StartNewQueue -- Too early to mix on this masternode!" /* Continued */
11631164
" masternode=%s addr=%s nLastDsq=%d nDsqThreshold=%d nDsqCount=%d\n",
11641165
dmn->proTxHash.ToString(), dmn->pdmnState->addr.ToString(), nLastDsq,
1165-
nDsqThreshold, mmetaman->GetDsqCount());
1166+
nDsqThreshold, m_mn_metaman.GetDsqCount());
11661167
nTries++;
11671168
continue;
11681169
}
@@ -1890,10 +1891,9 @@ void CCoinJoinClientManager::GetJsonInfo(UniValue& obj) const
18901891
}
18911892

18921893
void CoinJoinWalletManager::Add(CWallet& wallet) {
1893-
assert(::masternodeSync != nullptr);
18941894
m_wallet_manager_map.try_emplace(
18951895
wallet.GetName(),
1896-
std::make_unique<CCoinJoinClientManager>(wallet, *this, m_dmnman, m_mn_sync, m_queueman)
1896+
std::make_unique<CCoinJoinClientManager>(wallet, *this, m_dmnman, m_mn_metaman, m_mn_sync, m_queueman)
18971897
);
18981898
g_wallet_init_interface.InitCoinJoinSettings(*this);
18991899
}

src/coinjoin/client.h

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ class CCoinJoinClientQueueManager;
2121
class CConnman;
2222
class CDeterministicMN;
2323
class CDeterministicMNManager;
24-
class CoinJoinWalletManager;
2524
class CNode;
25+
class CMasternodeMetaMan;
2626
class CMasternodeSync;
27+
class CoinJoinWalletManager;
2728
class CTxMemPool;
2829

2930
class UniValue;
@@ -72,9 +73,10 @@ class CoinJoinWalletManager {
7273
using wallet_name_cjman_map = std::map<const std::string, std::unique_ptr<CCoinJoinClientManager>>;
7374

7475
public:
75-
CoinJoinWalletManager(CConnman& connman, CDeterministicMNManager& dmnman, CTxMemPool& mempool, const CMasternodeSync& mn_sync,
76-
const std::unique_ptr<CCoinJoinClientQueueManager>& queueman)
77-
: m_connman(connman), m_dmnman(dmnman), m_mempool(mempool), m_mn_sync(mn_sync), m_queueman(queueman) {}
76+
CoinJoinWalletManager(CConnman& connman, CDeterministicMNManager& dmnman, CMasternodeMetaMan& mn_metaman, CTxMemPool& mempool,
77+
const CMasternodeSync& mn_sync, const std::unique_ptr<CCoinJoinClientQueueManager>& queueman)
78+
: m_connman(connman), m_dmnman(dmnman), m_mn_metaman(mn_metaman), m_mempool(mempool), m_mn_sync(mn_sync), m_queueman(queueman) {}
79+
7880
~CoinJoinWalletManager() {
7981
for (auto& [wallet_name, cj_man] : m_wallet_manager_map) {
8082
cj_man.reset();
@@ -94,6 +96,7 @@ class CoinJoinWalletManager {
9496
private:
9597
CConnman& m_connman;
9698
CDeterministicMNManager& m_dmnman;
99+
CMasternodeMetaMan& m_mn_metaman;
97100
CTxMemPool& m_mempool;
98101
const CMasternodeSync& m_mn_sync;
99102
const std::unique_ptr<CCoinJoinClientQueueManager>& m_queueman;
@@ -108,6 +111,7 @@ class CCoinJoinClientSession : public CCoinJoinBaseSession
108111
CoinJoinWalletManager& m_walletman;
109112
CCoinJoinClientManager& m_manager;
110113
CDeterministicMNManager& m_dmnman;
114+
CMasternodeMetaMan& m_mn_metaman;
111115
const CMasternodeSync& m_mn_sync;
112116
const std::unique_ptr<CCoinJoinClientQueueManager>& m_queueman;
113117

@@ -157,8 +161,8 @@ class CCoinJoinClientSession : public CCoinJoinBaseSession
157161
void SetNull() override EXCLUSIVE_LOCKS_REQUIRED(cs_coinjoin);
158162

159163
public:
160-
explicit CCoinJoinClientSession(CWallet& wallet, CoinJoinWalletManager& walletman, CDeterministicMNManager& dmnman, const CMasternodeSync& mn_sync,
161-
const std::unique_ptr<CCoinJoinClientQueueManager>& queueman);
164+
explicit CCoinJoinClientSession(CWallet& wallet, CoinJoinWalletManager& walletman, CDeterministicMNManager& dmnman, CMasternodeMetaMan& mn_metaman,
165+
const CMasternodeSync& mn_sync, const std::unique_ptr<CCoinJoinClientQueueManager>& queueman);
162166

163167
void ProcessMessage(CNode& peer, CConnman& connman, const CTxMemPool& mempool, std::string_view msg_type, CDataStream& vRecv);
164168

@@ -191,13 +195,14 @@ class CCoinJoinClientQueueManager : public CCoinJoinBaseManager
191195
CConnman& connman;
192196
CoinJoinWalletManager& m_walletman;
193197
CDeterministicMNManager& m_dmnman;
198+
CMasternodeMetaMan& m_mn_metaman;
194199
const CMasternodeSync& m_mn_sync;
195200
mutable Mutex cs_ProcessDSQueue;
196201

197202
public:
198203
explicit CCoinJoinClientQueueManager(CConnman& _connman, CoinJoinWalletManager& walletman, CDeterministicMNManager& dmnman,
199-
const CMasternodeSync& mn_sync) :
200-
connman(_connman), m_walletman(walletman), m_dmnman(dmnman), m_mn_sync(mn_sync) {};
204+
CMasternodeMetaMan& mn_metaman, const CMasternodeSync& mn_sync) :
205+
connman(_connman), m_walletman(walletman), m_dmnman(dmnman), m_mn_metaman(mn_metaman), m_mn_sync(mn_sync) {};
201206

202207
PeerMsgRet ProcessMessage(const CNode& peer, std::string_view msg_type, CDataStream& vRecv) LOCKS_EXCLUDED(cs_vecqueue);
203208
PeerMsgRet ProcessDSQueue(const CNode& peer, CDataStream& vRecv);
@@ -212,6 +217,7 @@ class CCoinJoinClientManager
212217
CWallet& m_wallet;
213218
CoinJoinWalletManager& m_walletman;
214219
CDeterministicMNManager& m_dmnman;
220+
CMasternodeMetaMan& m_mn_metaman;
215221
const CMasternodeSync& m_mn_sync;
216222
const std::unique_ptr<CCoinJoinClientQueueManager>& m_queueman;
217223

@@ -244,9 +250,10 @@ class CCoinJoinClientManager
244250
CCoinJoinClientManager(CCoinJoinClientManager const&) = delete;
245251
CCoinJoinClientManager& operator=(CCoinJoinClientManager const&) = delete;
246252

247-
explicit CCoinJoinClientManager(CWallet& wallet, CoinJoinWalletManager& walletman, CDeterministicMNManager& dmnman, const CMasternodeSync& mn_sync,
253+
explicit CCoinJoinClientManager(CWallet& wallet, CoinJoinWalletManager& walletman, CDeterministicMNManager& dmnman,
254+
CMasternodeMetaMan& mn_metaman, const CMasternodeSync& mn_sync,
248255
const std::unique_ptr<CCoinJoinClientQueueManager>& queueman) :
249-
m_wallet(wallet), m_walletman(walletman), m_dmnman(dmnman), m_mn_sync(mn_sync), m_queueman(queueman) {}
256+
m_wallet(wallet), m_walletman(walletman), m_dmnman(dmnman), m_mn_metaman(mn_metaman), m_mn_sync(mn_sync), m_queueman(queueman) {}
250257

251258
void ProcessMessage(CNode& peer, CConnman& connman, const CTxMemPool& mempool, std::string_view msg_type, CDataStream& vRecv) LOCKS_EXCLUDED(cs_deqsessions);
252259

src/coinjoin/context.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
#endif // ENABLE_WALLET
1414
#include <coinjoin/server.h>
1515

16-
CJContext::CJContext(CChainState& chainstate, CConnman& connman, CDeterministicMNManager& dmnman, CTxMemPool& mempool,
17-
const CActiveMasternodeManager* const mn_activeman, const CMasternodeSync& mn_sync, bool relay_txes) :
16+
CJContext::CJContext(CChainState& chainstate, CConnman& connman, CDeterministicMNManager& dmnman, CMasternodeMetaMan& mn_metaman,
17+
CTxMemPool& mempool, const CActiveMasternodeManager* const mn_activeman, const CMasternodeSync& mn_sync,
18+
bool relay_txes) :
1819
dstxman{std::make_unique<CDSTXManager>()},
1920
#ifdef ENABLE_WALLET
20-
walletman{std::make_unique<CoinJoinWalletManager>(connman, dmnman, mempool, mn_sync, queueman)},
21-
queueman {relay_txes ? std::make_unique<CCoinJoinClientQueueManager>(connman, *walletman, dmnman, mn_sync) : nullptr},
21+
walletman{std::make_unique<CoinJoinWalletManager>(connman, dmnman, mn_metaman, mempool, mn_sync, queueman)},
22+
queueman {relay_txes ? std::make_unique<CCoinJoinClientQueueManager>(connman, *walletman, dmnman, mn_metaman, mn_sync) : nullptr},
2223
#endif // ENABLE_WALLET
23-
server{std::make_unique<CCoinJoinServer>(chainstate, connman, dmnman, *dstxman, mempool, mn_activeman, mn_sync)}
24+
server{std::make_unique<CCoinJoinServer>(chainstate, connman, dmnman, *dstxman, mn_metaman, mempool, mn_activeman, mn_sync)}
2425
{}
2526

2627
CJContext::~CJContext() {}

src/coinjoin/context.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class CCoinJoinServer;
1818
class CConnman;
1919
class CDeterministicMNManager;
2020
class CDSTXManager;
21+
class CMasternodeMetaMan;
2122
class CMasternodeSync;
2223
class CTxMemPool;
2324

@@ -29,8 +30,9 @@ class CoinJoinWalletManager;
2930
struct CJContext {
3031
CJContext() = delete;
3132
CJContext(const CJContext&) = delete;
32-
CJContext(CChainState& chainstate, CConnman& connman, CDeterministicMNManager& dmnman, CTxMemPool& mempool,
33-
const CActiveMasternodeManager* const mn_activeman, const CMasternodeSync& mn_sync, bool relay_txes);
33+
CJContext(CChainState& chainstate, CConnman& connman, CDeterministicMNManager& dmnman, CMasternodeMetaMan& mn_metaman,
34+
CTxMemPool& mempool, const CActiveMasternodeManager* const mn_activeman, const CMasternodeSync& mn_sync,
35+
bool relay_txes);
3436
~CJContext();
3537

3638
const std::unique_ptr<CDSTXManager> dstxman;

src/coinjoin/server.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ PeerMsgRet CCoinJoinServer::ProcessMessage(CNode& peer, std::string_view msg_typ
4444
void CCoinJoinServer::ProcessDSACCEPT(CNode& peer, CDataStream& vRecv)
4545
{
4646
assert(m_mn_activeman);
47-
assert(::mmetaman->IsValid());
47+
assert(m_mn_metaman.IsValid());
4848

4949
if (IsSessionReady()) {
5050
// too many users in this session already, reject new ones
@@ -81,9 +81,9 @@ void CCoinJoinServer::ProcessDSACCEPT(CNode& peer, CDataStream& vRecv)
8181
}
8282
}
8383

84-
int64_t nLastDsq = mmetaman->GetMetaInfo(dmn->proTxHash)->GetLastDsq();
85-
int64_t nDsqThreshold = mmetaman->GetDsqThreshold(dmn->proTxHash, mnList.GetValidMNsCount());
86-
if (nLastDsq != 0 && nDsqThreshold > mmetaman->GetDsqCount()) {
84+
int64_t nLastDsq = m_mn_metaman.GetMetaInfo(dmn->proTxHash)->GetLastDsq();
85+
int64_t nDsqThreshold = m_mn_metaman.GetDsqThreshold(dmn->proTxHash, mnList.GetValidMNsCount());
86+
if (nLastDsq != 0 && nDsqThreshold > m_mn_metaman.GetDsqCount()) {
8787
if (fLogIPs) {
8888
LogPrint(BCLog::COINJOIN, "DSACCEPT -- last dsq too recent, must wait: peer=%d, addr=%s\n", peer.GetId(), peer.addr.ToString());
8989
} else {
@@ -111,7 +111,7 @@ void CCoinJoinServer::ProcessDSACCEPT(CNode& peer, CDataStream& vRecv)
111111

112112
PeerMsgRet CCoinJoinServer::ProcessDSQUEUE(const CNode& peer, CDataStream& vRecv)
113113
{
114-
assert(::mmetaman->IsValid());
114+
assert(m_mn_metaman.IsValid());
115115

116116
CCoinJoinQueue dsq;
117117
vRecv >> dsq;
@@ -162,15 +162,15 @@ PeerMsgRet CCoinJoinServer::ProcessDSQUEUE(const CNode& peer, CDataStream& vRecv
162162
}
163163

164164
if (!dsq.fReady) {
165-
int64_t nLastDsq = mmetaman->GetMetaInfo(dmn->proTxHash)->GetLastDsq();
166-
int64_t nDsqThreshold = mmetaman->GetDsqThreshold(dmn->proTxHash, tip_mn_list.GetValidMNsCount());
167-
LogPrint(BCLog::COINJOIN, "DSQUEUE -- nLastDsq: %d nDsqThreshold: %d nDsqCount: %d\n", nLastDsq, nDsqThreshold, mmetaman->GetDsqCount());
165+
int64_t nLastDsq = m_mn_metaman.GetMetaInfo(dmn->proTxHash)->GetLastDsq();
166+
int64_t nDsqThreshold = m_mn_metaman.GetDsqThreshold(dmn->proTxHash, tip_mn_list.GetValidMNsCount());
167+
LogPrint(BCLog::COINJOIN, "DSQUEUE -- nLastDsq: %d nDsqThreshold: %d nDsqCount: %d\n", nLastDsq, nDsqThreshold, m_mn_metaman.GetDsqCount());
168168
//don't allow a few nodes to dominate the queuing process
169-
if (nLastDsq != 0 && nDsqThreshold > mmetaman->GetDsqCount()) {
169+
if (nLastDsq != 0 && nDsqThreshold > m_mn_metaman.GetDsqCount()) {
170170
LogPrint(BCLog::COINJOIN, "DSQUEUE -- Masternode %s is sending too many dsq messages\n", dmn->pdmnState->addr.ToString());
171171
return {};
172172
}
173-
mmetaman->AllowMixing(dmn->proTxHash);
173+
m_mn_metaman.AllowMixing(dmn->proTxHash);
174174

175175
LogPrint(BCLog::COINJOIN, "DSQUEUE -- new CoinJoin queue (%s) from masternode %s\n", dsq.ToString(), dmn->pdmnState->addr.ToString());
176176

src/coinjoin/server.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class CCoinJoinServer;
1515
class CDataStream;
1616
class CDeterministicMNManager;
1717
class CDSTXManager;
18+
class CMasternodeMetaMan;
1819
class CNode;
1920
class CTxMemPool;
2021

@@ -29,6 +30,7 @@ class CCoinJoinServer : public CCoinJoinBaseSession, public CCoinJoinBaseManager
2930
CConnman& connman;
3031
CDeterministicMNManager& m_dmnman;
3132
CDSTXManager& m_dstxman;
33+
CMasternodeMetaMan& m_mn_metaman;
3234
CTxMemPool& mempool;
3335
const CActiveMasternodeManager* const m_mn_activeman;
3436
const CMasternodeSync& m_mn_sync;
@@ -87,11 +89,13 @@ class CCoinJoinServer : public CCoinJoinBaseSession, public CCoinJoinBaseManager
8789

8890
public:
8991
explicit CCoinJoinServer(CChainState& chainstate, CConnman& _connman, CDeterministicMNManager& dmnman, CDSTXManager& dstxman,
90-
CTxMemPool& mempool, const CActiveMasternodeManager* const mn_activeman, const CMasternodeSync& mn_sync) :
92+
CMasternodeMetaMan& mn_metaman, CTxMemPool& mempool, const CActiveMasternodeManager* const mn_activeman,
93+
const CMasternodeSync& mn_sync) :
9194
m_chainstate(chainstate),
9295
connman(_connman),
9396
m_dmnman(dmnman),
9497
m_dstxman(dstxman),
98+
m_mn_metaman(mn_metaman),
9599
mempool(mempool),
96100
m_mn_activeman(mn_activeman),
97101
m_mn_sync(mn_sync),

src/dsnotificationinterface.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@
2626
CDSNotificationInterface::CDSNotificationInterface(CConnman& connman,
2727
CMasternodeSync& mn_sync,
2828
CGovernanceManager& govman,
29+
const CActiveMasternodeManager* const mn_activeman,
2930
const std::unique_ptr<CDeterministicMNManager>& dmnman,
3031
const std::unique_ptr<LLMQContext>& llmq_ctx,
3132
const std::unique_ptr<CJContext>& cj_ctx)
3233
: m_connman(connman),
3334
m_mn_sync(mn_sync),
3435
m_govman(govman),
36+
m_mn_activeman(mn_activeman),
3537
m_dmnman(dmnman),
3638
m_llmq_ctx(llmq_ctx),
3739
m_cj_ctx(cj_ctx) {}
@@ -94,7 +96,7 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con
9496
m_llmq_ctx->qdkgsman->UpdatedBlockTip(pindexNew, fInitialDownload);
9597
m_llmq_ctx->ehfSignalsHandler->UpdatedBlockTip(pindexNew);
9698

97-
if (!fDisableGovernance) m_govman.UpdatedBlockTip(pindexNew, m_connman);
99+
if (!fDisableGovernance) m_govman.UpdatedBlockTip(pindexNew, m_connman, m_mn_activeman);
98100
}
99101

100102
void CDSNotificationInterface::TransactionAddedToMempool(const CTransactionRef& ptx, int64_t nAcceptTime)

src/dsnotificationinterface.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <validationinterface.h>
99

10+
class CActiveMasternodeManager;
1011
class CConnman;
1112
class CDeterministicMNManager;
1213
class CGovernanceManager;
@@ -20,6 +21,7 @@ class CDSNotificationInterface : public CValidationInterface
2021
explicit CDSNotificationInterface(CConnman& connman,
2122
CMasternodeSync& mn_sync,
2223
CGovernanceManager& govman,
24+
const CActiveMasternodeManager* const mn_activeman,
2325
const std::unique_ptr<CDeterministicMNManager>& dmnman,
2426
const std::unique_ptr<LLMQContext>& llmq_ctx,
2527
const std::unique_ptr<CJContext>& cj_ctx);
@@ -47,6 +49,7 @@ class CDSNotificationInterface : public CValidationInterface
4749
CMasternodeSync& m_mn_sync;
4850
CGovernanceManager& m_govman;
4951

52+
const CActiveMasternodeManager* const m_mn_activeman;
5053
const std::unique_ptr<CDeterministicMNManager>& m_dmnman;
5154
const std::unique_ptr<LLMQContext>& m_llmq_ctx;
5255
const std::unique_ptr<CJContext>& m_cj_ctx;

src/evo/deterministicmns.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
static const std::string DB_LIST_SNAPSHOT = "dmn_S3";
2828
static const std::string DB_LIST_DIFF = "dmn_D3";
2929

30-
std::unique_ptr<CDeterministicMNManager> deterministicMNManager;
31-
3230
uint64_t CDeterministicMN::GetInternalId() const
3331
{
3432
// can't get it if it wasn't set yet

0 commit comments

Comments
 (0)