1010
1111const std::string MasternodeMetaStore::SERIALIZATION_VERSION_STRING = " CMasternodeMetaMan-Version-5" ;
1212
13+ static constexpr int MASTERNODE_MAX_FAILED_OUTBOUND_ATTEMPTS{5 };
14+ static constexpr int MASTERNODE_MAX_MIXING_TXES{5 };
15+
1316CMasternodeMetaMan::CMasternodeMetaMan () :
1417 m_db{std::make_unique<db_type>(" mncache.dat" , " magicMasternodeCache" )}
1518{
@@ -33,8 +36,8 @@ UniValue CMasternodeMetaInfo::ToJson() const
3336 int64_t now = GetTime<std::chrono::seconds>().count ();
3437
3538 UniValue ret (UniValue::VOBJ);
36- ret.pushKV (" lastDSQ" , nLastDsq );
37- ret.pushKV (" mixingTxCount" , nMixingTxCount );
39+ ret.pushKV (" lastDSQ" , m_last_dsq );
40+ ret.pushKV (" mixingTxCount" , m_mixing_tx_count );
3841 ret.pushKV (" outboundAttemptCount" , outboundAttemptCount);
3942 ret.pushKV (" lastOutboundAttempt" , lastOutboundAttempt);
4043 ret.pushKV (" lastOutboundAttemptElapsed" , now - lastOutboundAttempt);
@@ -87,7 +90,7 @@ bool CMasternodeMetaMan::IsDsqOver(const uint256& protx_hash, int mn_count) cons
8790 return false ;
8891 }
8992 const auto & meta_info = it->second ;
90- int64_t last_dsq = meta_info.GetLastDsq () ;
93+ int64_t last_dsq = meta_info.m_last_dsq ;
9194 int64_t threshold = last_dsq + mn_count / 5 ;
9295
9396 LogPrint (BCLog::COINJOIN, " DSQUEUE -- mn: %s last_dsq: %d dsq_threshold: %d nDsqCount: %d\n " ,
@@ -100,15 +103,15 @@ void CMasternodeMetaMan::AllowMixing(const uint256& proTxHash)
100103 LOCK (cs);
101104 auto & mm = GetMetaInfo (proTxHash);
102105 nDsqCount++;
103- mm.nLastDsq = nDsqCount.load ();
104- mm.nMixingTxCount = 0 ;
106+ mm.m_last_dsq = nDsqCount.load ();
107+ mm.m_mixing_tx_count = 0 ;
105108}
106109
107110void CMasternodeMetaMan::DisallowMixing (const uint256& proTxHash)
108111{
109112 LOCK (cs);
110113 auto & mm = GetMetaInfo (proTxHash);
111- mm.nMixingTxCount ++;
114+ mm.m_mixing_tx_count ++;
112115}
113116
114117bool CMasternodeMetaMan::IsValidForMixingTxes (const uint256& protx_hash) const
@@ -118,7 +121,7 @@ bool CMasternodeMetaMan::IsValidForMixingTxes(const uint256& protx_hash) const
118121 auto it = metaInfos.find (protx_hash);
119122 if (it == metaInfos.end ()) return true ;
120123
121- return it->second .IsValidForMixingTxes () ;
124+ return it->second .m_mixing_tx_count <= MASTERNODE_MAX_MIXING_TXES ;
122125}
123126
124127bool CMasternodeMetaMan::AddGovernanceVote (const uint256& proTxHash, const uint256& nGovernanceObjectHash)
@@ -175,7 +178,7 @@ int64_t CMasternodeMetaMan::GetLastOutboundAttempt(const uint256& protx_hash) co
175178 auto it = metaInfos.find (protx_hash);
176179 if (it == metaInfos.end ()) return 0 ;
177180
178- return it->second .GetLastOutboundAttempt () ;
181+ return it->second .lastOutboundAttempt ;
179182}
180183
181184int64_t CMasternodeMetaMan::GetLastOutboundSuccess (const uint256& protx_hash) const
@@ -185,7 +188,7 @@ int64_t CMasternodeMetaMan::GetLastOutboundSuccess(const uint256& protx_hash) co
185188 auto it = metaInfos.find (protx_hash);
186189 if (it == metaInfos.end ()) return 0 ;
187190
188- return it->second .GetLastOutboundSuccess () ;
191+ return it->second .lastOutboundSuccess ;
189192}
190193
191194bool CMasternodeMetaMan::OutboundFailedTooManyTimes (const uint256& protx_hash) const
@@ -195,7 +198,7 @@ bool CMasternodeMetaMan::OutboundFailedTooManyTimes(const uint256& protx_hash) c
195198 auto it = metaInfos.find (protx_hash);
196199 if (it == metaInfos.end ()) return false ;
197200
198- return it->second .OutboundFailedTooManyTimes () ;
201+ return it->second .outboundAttemptCount > MASTERNODE_MAX_FAILED_OUTBOUND_ATTEMPTS ;
199202}
200203
201204bool CMasternodeMetaMan::IsPlatformBanned (const uint256& protx_hash) const
@@ -205,7 +208,7 @@ bool CMasternodeMetaMan::IsPlatformBanned(const uint256& protx_hash) const
205208 auto it = metaInfos.find (protx_hash);
206209 if (it == metaInfos.end ()) return false ;
207210
208- return it->second .IsPlatformBanned () ;
211+ return it->second .m_platform_ban ;
209212}
210213
211214bool CMasternodeMetaMan::ResetPlatformBan (const uint256& protx_hash, int height)
0 commit comments