LCOV - code coverage report
Current view: top level - src/tiertwo - masternode_meta_manager.cpp (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 17 18 94.4 %
Date: 2026-08-09 10:51:41 Functions: 3 3 100.0 %

          Line data    Source code
       1             : // Copyright (c) 2014-2021 The Dash Core developers
       2             : // Copyright (c) 2021 The PIVX Core developers
       3             : // Distributed under the X11 software license, see the accompanying
       4             : // file COPYING or https://www.opensource.org/licenses/mit-license.php.
       5             : 
       6             : #include "tiertwo/masternode_meta_manager.h"
       7             : #include <sstream>
       8             : 
       9             : CMasternodeMetaMan g_mmetaman;
      10             : 
      11             : const std::string CMasternodeMetaMan::SERIALIZATION_VERSION_STRING = "CMasternodeMetaMan-Version-2";
      12             : 
      13         125 : CMasternodeMetaInfoPtr CMasternodeMetaMan::GetMetaInfo(const uint256& proTxHash, bool fCreate)
      14             : {
      15         250 :     LOCK(cs_metaman);
      16         125 :     auto it = metaInfos.find(proTxHash);
      17         125 :     if (it != metaInfos.end()) {
      18         118 :         return it->second;
      19             :     }
      20           7 :     if (!fCreate) {
      21           0 :         return nullptr;
      22             :     }
      23          14 :     it = metaInfos.emplace(proTxHash, std::make_shared<CMasternodeMetaInfo>(proTxHash)).first;
      24         125 :     return it->second;
      25             : }
      26             : 
      27             : 
      28          69 : void CMasternodeMetaMan::Clear()
      29             : {
      30          69 :     LOCK(cs_metaman);
      31          69 :     metaInfos.clear();
      32          69 : }
      33             : 
      34         391 : std::string CMasternodeMetaMan::ToString()
      35             : {
      36         391 :     LOCK(cs_metaman);
      37         782 :     std::ostringstream info;
      38             : 
      39         391 :     info << "Masternodes: meta infos object count: " << (int)metaInfos.size();
      40         782 :     return info.str();
      41             : }

Generated by: LCOV version 1.14