PIVX Core
5.6.99
P2P Digital Currency
src
tiertwo
masternode_meta_manager.cpp
Go to the documentation of this file.
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
CMasternodeMetaInfoPtr
CMasternodeMetaMan::GetMetaInfo
(
const
uint256
&
proTxHash
,
bool
fCreate)
14
{
15
LOCK
(
cs_metaman
);
16
auto
it =
metaInfos
.find(
proTxHash
);
17
if
(it !=
metaInfos
.end()) {
18
return
it->second;
19
}
20
if
(!fCreate) {
21
return
nullptr
;
22
}
23
it =
metaInfos
.emplace(
proTxHash
, std::make_shared<CMasternodeMetaInfo>(
proTxHash
)).first;
24
return
it->second;
25
}
26
27
28
void
CMasternodeMetaMan::Clear
()
29
{
30
LOCK
(
cs_metaman
);
31
metaInfos
.clear();
32
}
33
34
std::string
CMasternodeMetaMan::ToString
()
35
{
36
LOCK
(
cs_metaman
);
37
std::ostringstream info;
38
39
info <<
"Masternodes: meta infos object count: "
<< (int)
metaInfos
.size();
40
return
info.str();
41
}
CMasternodeMetaMan
Definition:
masternode_meta_manager.h:52
CMasternodeMetaMan::SERIALIZATION_VERSION_STRING
static const std::string SERIALIZATION_VERSION_STRING
Definition:
masternode_meta_manager.h:54
CMasternodeMetaMan::ToString
std::string ToString()
Definition:
masternode_meta_manager.cpp:34
CMasternodeMetaMan::metaInfos
std::map< uint256, CMasternodeMetaInfoPtr > metaInfos
Definition:
masternode_meta_manager.h:56
CMasternodeMetaMan::cs_metaman
RecursiveMutex cs_metaman
Definition:
masternode_meta_manager.h:55
CMasternodeMetaMan::Clear
void Clear()
Definition:
masternode_meta_manager.cpp:28
CMasternodeMetaMan::GetMetaInfo
CMasternodeMetaInfoPtr GetMetaInfo(const uint256 &proTxHash, bool fCreate=true)
Definition:
masternode_meta_manager.cpp:13
uint256
256-bit opaque blob.
Definition:
uint256.h:138
LOCK
@ LOCK
Definition:
lockunlock.h:16
g_mmetaman
CMasternodeMetaMan g_mmetaman
Definition:
masternode_meta_manager.cpp:9
masternode_meta_manager.h
CMasternodeMetaInfoPtr
std::shared_ptr< CMasternodeMetaInfo > CMasternodeMetaInfoPtr
Definition:
masternode_meta_manager.h:49
proTxHash
@ proTxHash
Definition:
rpcevo.cpp:50
Generated on Wed Apr 2 2025 00:40:38 for PIVX Core by
1.9.1