Skip to content

Commit a40c418

Browse files
committed
refactor: hide direct calls of GetMetaInfo from llmq/utils
1 parent 7ba51ec commit a40c418

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

src/llmq/utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ void AddQuorumProbeConnections(const Consensus::LLMQParams& llmqParams, CConnman
912912
if (dmn->proTxHash == myProTxHash) {
913913
continue;
914914
}
915-
auto lastOutbound = mn_metaman.GetMetaInfo(dmn->proTxHash)->GetLastOutboundSuccess();
915+
auto lastOutbound = mn_metaman.GetLastOutboundSuccess(dmn->proTxHash);
916916
if (curTime - lastOutbound < 10 * 60) {
917917
// avoid re-probing nodes too often
918918
continue;

src/masternode/meta.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,16 @@ std::vector<uint256> CMasternodeMetaMan::GetAndClearDirtyGovernanceObjectHashes(
141141
return vecTmp;
142142
}
143143

144+
int64_t CMasternodeMetaMan::GetLastOutboundSuccess(const uint256& protx_hash) const
145+
{
146+
LOCK(cs);
147+
148+
auto it = metaInfos.find(protx_hash);
149+
if (it == metaInfos.end()) return 0;
150+
151+
return it->second->GetLastOutboundSuccess();
152+
}
153+
144154
bool CMasternodeMetaMan::OutboundFailedTooManyTimes(const uint256& protx_hash) const
145155
{
146156
LOCK(cs);

src/masternode/meta.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ class CMasternodeMetaMan : public MasternodeMetaStore
276276

277277
std::vector<uint256> GetAndClearDirtyGovernanceObjectHashes() EXCLUSIVE_LOCKS_REQUIRED(!cs);
278278

279+
int64_t GetLastOutboundSuccess(const uint256& protx_hash) const EXCLUSIVE_LOCKS_REQUIRED(!cs);
279280
bool OutboundFailedTooManyTimes(const uint256& protx_hash) const EXCLUSIVE_LOCKS_REQUIRED(!cs);
280281
bool IsPlatformBanned(const uint256& protx_hash) const EXCLUSIVE_LOCKS_REQUIRED(!cs);
281282
bool ResetPlatformBan(const uint256& protx_hash, int height) EXCLUSIVE_LOCKS_REQUIRED(!cs);

0 commit comments

Comments
 (0)