mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
masternode stop should disable MN and remove it from MN list
This commit is contained in:
parent
d7cdaad0e2
commit
27514f0f80
@ -211,7 +211,10 @@ bool CActiveMasternode::Dseep(CTxIn vin, CService service, CKey keyMasternode, C
|
||||
CMasternode* pmn = mnodeman.Find(vin);
|
||||
if(pmn != NULL)
|
||||
{
|
||||
pmn->UpdateLastSeen();
|
||||
if(stop)
|
||||
mnodeman.Remove(pmn->vin);
|
||||
else
|
||||
pmn->UpdateLastSeen();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -541,20 +541,6 @@ void CMasternodeMan::ProcessMasternodeConnections()
|
||||
}
|
||||
}
|
||||
|
||||
void CMasternodeMan::RelayMasternodeEntry(const CTxIn vin, const CService addr, const std::vector<unsigned char> vchSig, const int64_t nNow, const CPubKey pubkey, const CPubKey pubkey2, const int count, const int current, const int64_t lastUpdated, const int protocolVersion, CScript donationAddress, int donationPercentage)
|
||||
{
|
||||
LOCK(cs_vNodes);
|
||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
||||
pnode->PushMessage("dsee", vin, addr, vchSig, nNow, pubkey, pubkey2, count, current, lastUpdated, protocolVersion, donationAddress, donationPercentage);
|
||||
}
|
||||
|
||||
void CMasternodeMan::RelayMasternodeEntryPing(const CTxIn vin, const std::vector<unsigned char> vchSig, const int64_t nNow, const bool stop)
|
||||
{
|
||||
LOCK(cs_vNodes);
|
||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
||||
pnode->PushMessage("dseep", vin, vchSig, nNow, stop);
|
||||
}
|
||||
|
||||
void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv)
|
||||
{
|
||||
|
||||
@ -895,6 +881,34 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
|
||||
|
||||
}
|
||||
|
||||
void CMasternodeMan::RelayMasternodeEntry(const CTxIn vin, const CService addr, const std::vector<unsigned char> vchSig, const int64_t nNow, const CPubKey pubkey, const CPubKey pubkey2, const int count, const int current, const int64_t lastUpdated, const int protocolVersion, CScript donationAddress, int donationPercentage)
|
||||
{
|
||||
LOCK(cs_vNodes);
|
||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
||||
pnode->PushMessage("dsee", vin, addr, vchSig, nNow, pubkey, pubkey2, count, current, lastUpdated, protocolVersion, donationAddress, donationPercentage);
|
||||
}
|
||||
|
||||
void CMasternodeMan::RelayMasternodeEntryPing(const CTxIn vin, const std::vector<unsigned char> vchSig, const int64_t nNow, const bool stop)
|
||||
{
|
||||
LOCK(cs_vNodes);
|
||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
||||
pnode->PushMessage("dseep", vin, vchSig, nNow, stop);
|
||||
}
|
||||
|
||||
void CMasternodeMan::Remove(CTxIn vin)
|
||||
{
|
||||
LOCK(cs);
|
||||
|
||||
vector<CMasternode>::iterator it = vMasternodes.begin();
|
||||
while(it != vMasternodes.end()){
|
||||
if((*it).vin == vin){
|
||||
if(fDebug) LogPrintf("CMasternodeMan: Removing Masternode %s - %i now\n", (*it).addr.ToString().c_str(), size() - 1);
|
||||
vMasternodes.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string CMasternodeMan::ToString() const
|
||||
{
|
||||
std::ostringstream info;
|
||||
|
@ -125,10 +125,10 @@ public:
|
||||
int GetMasternodeRank(const CTxIn &vin, int64_t nBlockHeight, int minProtocol=0, bool fOnlyActive=true);
|
||||
CMasternode* GetMasternodeByRank(int nRank, int64_t nBlockHeight, int minProtocol=0, bool fOnlyActive=true);
|
||||
|
||||
void ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv);
|
||||
|
||||
void ProcessMasternodeConnections();
|
||||
|
||||
void ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv);
|
||||
|
||||
/// Return the number of (unique) Masternodes
|
||||
int size() { return vMasternodes.size(); }
|
||||
|
||||
@ -141,6 +141,7 @@ public:
|
||||
void RelayMasternodeEntry(const CTxIn vin, const CService addr, const std::vector<unsigned char> vchSig, const int64_t nNow, const CPubKey pubkey, const CPubKey pubkey2, const int count, const int current, const int64_t lastUpdated, const int protocolVersion, CScript donationAddress, int donationPercentage);
|
||||
void RelayMasternodeEntryPing(const CTxIn vin, const std::vector<unsigned char> vchSig, const int64_t nNow, const bool stop);
|
||||
|
||||
void Remove(CTxIn vin);
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user