PIVX Core  5.6.99
P2P Digital Currency
tiertwo_sync_state.cpp
Go to the documentation of this file.
1 // Copyright (c) 2021 The PIVX Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or https://www.opensource.org/licenses/mit-license.php.
4 
6 #include "uint256.h"
7 #include "utiltime.h"
8 
10 
11 static void UpdateLastTime(const uint256& hash, int64_t& last, std::map<uint256, int>& mapSeen)
12 {
13  auto it = mapSeen.find(hash);
14  if (it != mapSeen.end()) {
15  if (it->second < MASTERNODE_SYNC_THRESHOLD) {
16  last = GetTime();
17  it->second++;
18  }
19  } else {
20  last = GetTime();
21  mapSeen.emplace(hash, 1);
22  }
23 }
24 
26 {
27  UpdateLastTime(hash, lastMasternodeList, mapSeenSyncMNB);
28 }
29 
31 {
32  UpdateLastTime(hash, lastMasternodeWinner, mapSeenSyncMNW);
33 }
34 
36 {
37  UpdateLastTime(hash, lastBudgetItem, mapSeenSyncBudget);
38 }
39 
41 {
44  lastBudgetItem = 0;
45  mapSeenSyncMNB.clear();
46  mapSeenSyncMNW.clear();
47  mapSeenSyncBudget.clear();
48 }
std::map< uint256, int > mapSeenSyncMNB
void AddedMasternodeList(const uint256 &hash)
std::map< uint256, int > mapSeenSyncBudget
void AddedMasternodeWinner(const uint256 &hash)
void AddedBudgetItem(const uint256 &hash)
std::map< uint256, int > mapSeenSyncMNW
256-bit opaque blob.
Definition: uint256.h:138
TierTwoSyncState g_tiertwo_sync_state
#define MASTERNODE_SYNC_THRESHOLD
int64_t GetTime()
DEPRECATED Use either GetSystemTimeInSeconds (not mockable) or GetTime<T> (mockable)
Definition: utiltime.cpp:27