Skip to content

Commit 6cb2344

Browse files
committed
refactor: replace direct call of MetaInfo from rpc/evo code to helper
1 parent 3dd74c6 commit 6cb2344

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/masternode/meta.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ void CMasternodeMetaInfo::RemoveGovernanceObject(const uint256& nGovernanceObjec
6666
mapGovernanceObjectsVotedOn.erase(nGovernanceObjectHash);
6767
}
6868

69+
CMasternodeMetaInfo CMasternodeMetaMan::GetInfo(const uint256& proTxHash)
70+
{
71+
const auto info = GetMetaInfo(proTxHash, false);
72+
if (info == nullptr) return CMasternodeMetaInfo{};
73+
74+
return *info;
75+
}
76+
6977
CMasternodeMetaInfoPtr CMasternodeMetaMan::GetMetaInfo(const uint256& proTxHash, bool fCreate)
7078
{
7179
LOCK(cs);

src/masternode/meta.h

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

260260
bool IsValid() const { return is_valid; }
261261

262+
CMasternodeMetaInfo GetInfo(const uint256& proTxHash) EXCLUSIVE_LOCKS_REQUIRED(!cs);
262263
CMasternodeMetaInfoPtr GetMetaInfo(const uint256& proTxHash, bool fCreate = true) EXCLUSIVE_LOCKS_REQUIRED(!cs);
263264

264265
int64_t GetDsqCount() const { return nDsqCount; }

src/rpc/evo.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,8 +1379,7 @@ static UniValue BuildDMNListEntry(const CWallet* const pwallet, const CDetermini
13791379
}
13801380
#endif
13811381

1382-
const auto metaInfo = mn_metaman.GetMetaInfo(dmn.proTxHash);
1383-
o.pushKV("metaInfo", metaInfo->ToJson());
1382+
o.pushKV("metaInfo", mn_metaman.GetInfo(dmn.proTxHash).ToJson());
13841383

13851384
return o;
13861385
}

0 commit comments

Comments
 (0)