Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions src/evo/deterministicmns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,6 @@ CDeterministicMNCPtr CDeterministicMNList::GetMNByService(const CService& servic
return GetUniquePropertyMN(service);
}

CDeterministicMNCPtr CDeterministicMNList::GetValidMNByService(const CService& service) const
{
auto dmn = GetUniquePropertyMN(service);
if (dmn && !IsMNValid(dmn)) {
return nullptr;
}
return dmn;
}

CDeterministicMNCPtr CDeterministicMNList::GetMNByInternalId(uint64_t internalId) const
{
auto proTxHash = mnInternalIdMap.find(internalId);
Expand Down
6 changes: 0 additions & 6 deletions src/evo/deterministicmns.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ class CDeterministicMN
std::string ToString() const;
void ToJson(UniValue& obj) const;
};
typedef std::shared_ptr<CDeterministicMN> CDeterministicMNPtr;
typedef std::shared_ptr<const CDeterministicMN> CDeterministicMNCPtr;

class CDeterministicMNListDiff;
Expand Down Expand Up @@ -392,10 +391,6 @@ class CDeterministicMNList
{
return GetMN(proTxHash) != nullptr;
}
bool HasValidMN(const uint256& proTxHash) const
{
return GetValidMN(proTxHash) != nullptr;
}
bool HasMNByCollateral(const COutPoint& collateralOutpoint) const
{
return GetMNByCollateral(collateralOutpoint) != nullptr;
Expand All @@ -410,7 +405,6 @@ class CDeterministicMNList
CDeterministicMNCPtr GetMNByCollateral(const COutPoint& collateralOutpoint) const;
CDeterministicMNCPtr GetValidMNByCollateral(const COutPoint& collateralOutpoint) const;
CDeterministicMNCPtr GetMNByService(const CService& service) const;
CDeterministicMNCPtr GetValidMNByService(const CService& service) const;
CDeterministicMNCPtr GetMNByInternalId(uint64_t internalId) const;
CDeterministicMNCPtr GetMNPayee() const;

Expand Down
2 changes: 0 additions & 2 deletions src/governance/governance-classes.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ class CSuperblock : public CGovernanceObject
int GetStatus() { return nStatus; }
void SetStatus(int nStatusIn) { nStatus = nStatusIn; }

// IS THIS TRIGGER ALREADY EXECUTED?
bool IsExecuted() { return nStatus == SEEN_OBJECT_EXECUTED; }
// TELL THE ENGINE WE EXECUTED THIS EVENT
void SetExecuted() { nStatus = SEEN_OBJECT_EXECUTED; }

Expand Down
13 changes: 0 additions & 13 deletions src/governance/governance-object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,19 +275,6 @@ std::set<uint256> CGovernanceObject::RemoveInvalidVotes(const COutPoint& mnOutpo
return removedVotes;
}

std::string CGovernanceObject::GetSignatureMessage() const
{
LOCK(cs);
std::string strMessage = nHashParent.ToString() + "|" +
std::to_string(nRevision) + "|" +
std::to_string(nTime) + "|" +
GetDataAsHexString() + "|" +
masternodeOutpoint.ToStringShort() + "|" +
nCollateralHash.ToString();

return strMessage;
}

uint256 CGovernanceObject::GetHash() const
{
// Note: doesn't match serialization
Expand Down
2 changes: 0 additions & 2 deletions src/governance/governance-object.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ static const int64_t GOVERNANCE_ORPHAN_EXPIRATION_TIME = 10 * 60;
// FOR SEEN MAP ARRAYS - GOVERNANCE OBJECTS AND VOTES
static const int SEEN_OBJECT_IS_VALID = 0;
static const int SEEN_OBJECT_ERROR_INVALID = 1;
static const int SEEN_OBJECT_ERROR_IMMATURE = 2;
static const int SEEN_OBJECT_EXECUTED = 3; //used for triggers
static const int SEEN_OBJECT_UNKNOWN = 4; // the default

Expand Down Expand Up @@ -258,7 +257,6 @@ class CGovernanceObject
bool Sign(const CBLSSecretKey& key);
bool CheckSignature(const CBLSPublicKey& pubKey) const;

std::string GetSignatureMessage() const;
uint256 GetSignatureHash() const;

// CORE OBJECT FUNCTIONS
Expand Down
2 changes: 0 additions & 2 deletions src/governance/governance-votedb.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class CGovernanceObjectVoteFile
typedef vote_m_t::const_iterator vote_m_cit;

private:
static const int MAX_MEMORY_VOTES = -1;

int nMemoryVotes;

vote_l_t listVotes;
Expand Down
17 changes: 0 additions & 17 deletions src/governance/governance.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,6 @@ class CGovernanceManager

typedef txout_m_t::iterator txout_m_it;

typedef txout_m_t::const_iterator txout_m_cit;

typedef std::map<COutPoint, int> txout_int_m_t;

typedef std::set<uint256> hash_s_t;

typedef hash_s_t::iterator hash_s_it;
Expand All @@ -212,14 +208,10 @@ class CGovernanceManager

typedef object_info_m_t::iterator object_info_m_it;

typedef object_info_m_t::const_iterator object_info_m_cit;

typedef std::map<uint256, int64_t> hash_time_m_t;

typedef hash_time_m_t::iterator hash_time_m_it;

typedef hash_time_m_t::const_iterator hash_time_m_cit;

private:
static const int MAX_CACHE_SIZE = 1000000;

Expand Down Expand Up @@ -380,10 +372,6 @@ class CGovernanceManager
mapPostponedObjects.insert(std::make_pair(govobj.GetHash(), govobj));
}

void AddSeenGovernanceObject(const uint256& nHash, int status);

void AddSeenVote(const uint256& nHash, int status);

void MasternodeRateUpdate(const CGovernanceObject& govobj);

bool MasternodeRateCheck(const CGovernanceObject& govobj, bool fUpdateFailStatus = false);
Expand Down Expand Up @@ -420,11 +408,6 @@ class CGovernanceManager
cmapInvalidVotes.Insert(vote.GetHash(), vote);
}

void AddOrphanVote(const CGovernanceVote& vote)
{
cmmapOrphanVotes.Insert(vote.GetHash(), vote_time_pair_t(vote, GetAdjustedTime() + GOVERNANCE_ORPHAN_EXPIRATION_TIME));
}

bool ProcessVote(CNode* pfrom, const CGovernanceVote& vote, CGovernanceException& exception, CConnman& connman);

/// Called to indicate a requested object has been received
Expand Down
9 changes: 0 additions & 9 deletions src/llmq/quorums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,13 +410,4 @@ CQuorumCPtr CQuorumManager::GetQuorum(Consensus::LLMQType llmqType, const CBlock
return quorum;
}

CQuorumCPtr CQuorumManager::GetNewestQuorum(Consensus::LLMQType llmqType)
{
auto quorums = ScanQuorums(llmqType, 1);
if (quorums.empty()) {
return nullptr;
}
return quorums.front();
}

} // namespace llmq
1 change: 0 additions & 1 deletion src/llmq/quorums.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ class CQuorumManager

// all these methods will lock cs_main for a short period of time
CQuorumCPtr GetQuorum(Consensus::LLMQType llmqType, const uint256& quorumHash);
CQuorumCPtr GetNewestQuorum(Consensus::LLMQType llmqType);
std::vector<CQuorumCPtr> ScanQuorums(Consensus::LLMQType llmqType, size_t maxCount);

// this one is cs_main-free
Expand Down
8 changes: 0 additions & 8 deletions src/llmq/quorums_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,6 @@ void CDKGDebugManager::InitLocalSessionStatus(Consensus::LLMQType llmqType, cons
session.members.resize((size_t)params.size);
}

void CDKGDebugManager::UpdateLocalStatus(std::function<bool(CDKGDebugStatus& status)>&& func)
{
LOCK(cs);
if (func(localStatus)) {
localStatus.nTime = GetAdjustedTime();
}
}

void CDKGDebugManager::UpdateLocalSessionStatus(Consensus::LLMQType llmqType, std::function<bool(CDKGDebugSessionStatus& status)>&& func)
{
LOCK(cs);
Expand Down
1 change: 0 additions & 1 deletion src/llmq/quorums_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ class CDKGDebugManager
void ResetLocalSessionStatus(Consensus::LLMQType llmqType);
void InitLocalSessionStatus(Consensus::LLMQType llmqType, const uint256& quorumHash, int quorumHeight);

void UpdateLocalStatus(std::function<bool(CDKGDebugStatus& status)>&& func);
void UpdateLocalSessionStatus(Consensus::LLMQType llmqType, std::function<bool(CDKGDebugSessionStatus& status)>&& func);
void UpdateLocalMemberStatus(Consensus::LLMQType llmqType, size_t memberIdx, std::function<bool(CDKGDebugMemberStatus& status)>&& func);
};
Expand Down
1 change: 0 additions & 1 deletion src/llmq/quorums_dkgsession.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ class CDKGSession
friend class CDKGSessionHandler;
friend class CDKGSessionManager;
friend class CDKGLogger;
template<typename Message> friend class CDKGMessageHandler;

private:
const Consensus::LLMQParams& params;
Expand Down
1 change: 0 additions & 1 deletion src/llmq/quorums_signing_shares.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ bool CSigSharesNodeState::GetSessionInfoByRecvId(uint32_t sessionId, SessionInfo
if (!s) {
return false;
}
retInfo.recvSessionId = sessionId;
retInfo.llmqType = s->llmqType;
retInfo.quorumHash = s->quorumHash;
retInfo.id = s->id;
Expand Down
1 change: 0 additions & 1 deletion src/llmq/quorums_signing_shares.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ class CSigSharesNodeState
// Used to avoid holding locks too long
struct SessionInfo
{
uint32_t recvSessionId;
Consensus::LLMQType llmqType;
uint256 quorumHash;
uint256 id;
Expand Down
6 changes: 0 additions & 6 deletions src/masternode/activemasternode.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@
struct CActiveMasternodeInfo;
class CActiveMasternodeManager;

static const int ACTIVE_MASTERNODE_INITIAL = 0; // initial state
static const int ACTIVE_MASTERNODE_SYNC_IN_PROCESS = 1;
static const int ACTIVE_MASTERNODE_INPUT_TOO_NEW = 2;
static const int ACTIVE_MASTERNODE_NOT_CAPABLE = 3;
static const int ACTIVE_MASTERNODE_STARTED = 4;

extern CActiveMasternodeInfo activeMasternodeInfo;
extern CActiveMasternodeManager* activeMasternodeManager;

Expand Down
20 changes: 0 additions & 20 deletions src/masternode/masternode-meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,6 @@ void CMasternodeMetaInfo::RemoveGovernanceObject(const uint256& nGovernanceObjec
mapGovernanceObjectsVotedOn.erase(nGovernanceObjectHash);
}

/**
* FLAG GOVERNANCE ITEMS AS DIRTY
*
* - When masternode come and go on the network, we must flag the items they voted on to recalc it's cached flags
*
*/
void CMasternodeMetaInfo::FlagGovernanceItemsAsDirty()
{
LOCK(cs);
for (auto& govObjHashPair : mapGovernanceObjectsVotedOn) {
mmetaman.AddDirtyGovernanceObjectHash(govObjHashPair.first);
}
}

CMasternodeMetaInfoPtr CMasternodeMetaMan::GetMetaInfo(const uint256& proTxHash, bool fCreate)
{
LOCK(cs);
Expand Down Expand Up @@ -87,12 +73,6 @@ void CMasternodeMetaMan::RemoveGovernanceObject(const uint256& nGovernanceObject
}
}

void CMasternodeMetaMan::AddDirtyGovernanceObjectHash(const uint256& nHash)
{
LOCK(cs);
vecDirtyGovernanceObjectHashes.push_back(nHash);
}

std::vector<uint256> CMasternodeMetaMan::GetAndClearDirtyGovernanceObjectHashes()
{
LOCK(cs);
Expand Down
9 changes: 0 additions & 9 deletions src/masternode/masternode-meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ class CMasternodeMetaInfo
{
}

template <typename Stream>
CMasternodeMetaInfo(deserialize_type, Stream& s)
{
s >> *this;
}

ADD_SERIALIZE_METHODS
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action)
Expand All @@ -70,8 +64,6 @@ class CMasternodeMetaInfo

// KEEP TRACK OF EACH GOVERNANCE ITEM INCASE THIS NODE GOES OFFLINE, SO WE CAN RECALC THEIR STATUS
void AddGovernanceVote(const uint256& nGovernanceObjectHash);
// RECALCULATE CACHED STATUS FLAGS FOR ALL AFFECTED OBJECTS
void FlagGovernanceItemsAsDirty();

void RemoveGovernanceObject(const uint256& nGovernanceObjectHash);
};
Expand Down Expand Up @@ -139,7 +131,6 @@ class CMasternodeMetaMan
bool AddGovernanceVote(const uint256& proTxHash, const uint256& nGovernanceObjectHash);
void RemoveGovernanceObject(const uint256& nGovernanceObjectHash);

void AddDirtyGovernanceObjectHash(const uint256& nHash);
std::vector<uint256> GetAndClearDirtyGovernanceObjectHashes();

void Clear();
Expand Down
6 changes: 0 additions & 6 deletions src/masternode/masternode-sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
class CMasternodeSync;
CMasternodeSync masternodeSync;

void CMasternodeSync::Fail()
{
nTimeLastFailure = GetTime();
nCurrentAsset = MASTERNODE_SYNC_FAILED;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that whole MASTERNODE_SYNC_FAILED state got impossible to get into, so all the code that handles the state can be removed as well. I'm wondering...can sync really not fail anymore? @UdjinM6

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, governance objects/votes are still off-chain and smth might go wrong there... but we have no way of figuring it out so, technically, it's not going to fail :)

}

void CMasternodeSync::Reset()
{
nCurrentAsset = MASTERNODE_SYNC_INITIAL;
Expand Down
2 changes: 0 additions & 2 deletions src/masternode/masternode-sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ class CMasternodeSync
// ... or failed
int64_t nTimeLastFailure;

void Fail();

public:
CMasternodeSync() { Reset(); }

Expand Down
45 changes: 0 additions & 45 deletions src/masternode/masternode-utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,51 +20,6 @@ struct CompareScoreMN
}
};

bool CMasternodeUtils::GetMasternodeScores(const uint256& nBlockHash, score_pair_vec_t& vecMasternodeScoresRet)
{
vecMasternodeScoresRet.clear();

auto mnList = deterministicMNManager->GetListAtChainTip();
auto scores = mnList.CalculateScores(nBlockHash);
for (const auto& p : scores) {
vecMasternodeScoresRet.emplace_back(p.first, p.second);
}

std::sort(vecMasternodeScoresRet.rbegin(), vecMasternodeScoresRet.rend(), CompareScoreMN());
return !vecMasternodeScoresRet.empty();
}

bool CMasternodeUtils::GetMasternodeRank(const COutPoint& outpoint, int& nRankRet, uint256& blockHashRet, int nBlockHeight)
{
nRankRet = -1;

if (!masternodeSync.IsBlockchainSynced())
return false;

// make sure we know about this block
blockHashRet = uint256();
if (!GetBlockHash(blockHashRet, nBlockHeight)) {
LogPrintf("CMasternodeUtils::%s -- ERROR: GetBlockHash() failed at nBlockHeight %d\n", __func__, nBlockHeight);
return false;
}

score_pair_vec_t vecMasternodeScores;
if (!GetMasternodeScores(blockHashRet, vecMasternodeScores))
return false;

int nRank = 0;
for (const auto& scorePair : vecMasternodeScores) {
nRank++;
if(scorePair.second->collateralOutpoint == outpoint) {
nRankRet = nRank;
return true;
}
}

return false;
}


void CMasternodeUtils::ProcessMasternodeConnections(CConnman& connman)
{
std::vector<CDeterministicMNCPtr> vecDmns; // will be empty when no wallet
Expand Down
9 changes: 0 additions & 9 deletions src/masternode/masternode-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,6 @@ class CConnman;
class CMasternodeUtils
{
public:
typedef std::pair<arith_uint256, CDeterministicMNCPtr> score_pair_t;
typedef std::vector<score_pair_t> score_pair_vec_t;
typedef std::pair<int, const CDeterministicMNCPtr> rank_pair_t;
typedef std::vector<rank_pair_t> rank_pair_vec_t;

public:
static bool GetMasternodeScores(const uint256& nBlockHash, score_pair_vec_t& vecMasternodeScoresRet);
static bool GetMasternodeRank(const COutPoint &outpoint, int& nRankRet, uint256& blockHashRet, int nBlockHeight = -1);

static void ProcessMasternodeConnections(CConnman& connman);
static void DoMaintenance(CConnman &connman);
};
Expand Down