Make sure to clear setAskFor in Dash submodules (#1730)
* Make sure to clear setAskFor in Dash submodules Thanks @sidhujag for finding the bug * partially revert previous commit * skip mnv until mn list is synced
This commit is contained in:
parent
3e86c41be5
commit
5d58dd90c2
@ -148,20 +148,20 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, std::string& strCommand, C
|
|||||||
{
|
{
|
||||||
// MAKE SURE WE HAVE A VALID REFERENCE TO THE TIP BEFORE CONTINUING
|
// MAKE SURE WE HAVE A VALID REFERENCE TO THE TIP BEFORE CONTINUING
|
||||||
|
|
||||||
|
CGovernanceObject govobj;
|
||||||
|
vRecv >> govobj;
|
||||||
|
|
||||||
|
uint256 nHash = govobj.GetHash();
|
||||||
|
|
||||||
|
pfrom->setAskFor.erase(nHash);
|
||||||
|
|
||||||
if(!masternodeSync.IsMasternodeListSynced()) {
|
if(!masternodeSync.IsMasternodeListSynced()) {
|
||||||
LogPrint("gobject", "MNGOVERNANCEOBJECT -- masternode list not synced\n");
|
LogPrint("gobject", "MNGOVERNANCEOBJECT -- masternode list not synced\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGovernanceObject govobj;
|
|
||||||
vRecv >> govobj;
|
|
||||||
|
|
||||||
uint256 nHash = govobj.GetHash();
|
|
||||||
std::string strHash = nHash.ToString();
|
std::string strHash = nHash.ToString();
|
||||||
|
|
||||||
pfrom->setAskFor.erase(nHash);
|
|
||||||
|
|
||||||
LogPrint("gobject", "MNGOVERNANCEOBJECT -- Received object: %s\n", strHash);
|
LogPrint("gobject", "MNGOVERNANCEOBJECT -- Received object: %s\n", strHash);
|
||||||
|
|
||||||
if(!AcceptObjectMessage(nHash)) {
|
if(!AcceptObjectMessage(nHash)) {
|
||||||
@ -232,22 +232,23 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, std::string& strCommand, C
|
|||||||
// A NEW GOVERNANCE OBJECT VOTE HAS ARRIVED
|
// A NEW GOVERNANCE OBJECT VOTE HAS ARRIVED
|
||||||
else if (strCommand == NetMsgType::MNGOVERNANCEOBJECTVOTE)
|
else if (strCommand == NetMsgType::MNGOVERNANCEOBJECTVOTE)
|
||||||
{
|
{
|
||||||
|
CGovernanceVote vote;
|
||||||
|
vRecv >> vote;
|
||||||
|
|
||||||
|
uint256 nHash = vote.GetHash();
|
||||||
|
|
||||||
|
pfrom->setAskFor.erase(nHash);
|
||||||
|
|
||||||
// Ignore such messages until masternode list is synced
|
// Ignore such messages until masternode list is synced
|
||||||
if(!masternodeSync.IsMasternodeListSynced()) {
|
if(!masternodeSync.IsMasternodeListSynced()) {
|
||||||
LogPrint("gobject", "MNGOVERNANCEOBJECTVOTE -- masternode list not synced\n");
|
LogPrint("gobject", "MNGOVERNANCEOBJECTVOTE -- masternode list not synced\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGovernanceVote vote;
|
|
||||||
vRecv >> vote;
|
|
||||||
|
|
||||||
LogPrint("gobject", "MNGOVERNANCEOBJECTVOTE -- Received vote: %s\n", vote.ToString());
|
LogPrint("gobject", "MNGOVERNANCEOBJECTVOTE -- Received vote: %s\n", vote.ToString());
|
||||||
|
|
||||||
uint256 nHash = vote.GetHash();
|
|
||||||
std::string strHash = nHash.ToString();
|
std::string strHash = nHash.ToString();
|
||||||
|
|
||||||
pfrom->setAskFor.erase(nHash);
|
|
||||||
|
|
||||||
if(!AcceptVoteMessage(nHash)) {
|
if(!AcceptVoteMessage(nHash)) {
|
||||||
LogPrint("gobject", "MNGOVERNANCEOBJECTVOTE -- Received unrequested vote object: %s, hash: %s, peer = %d\n",
|
LogPrint("gobject", "MNGOVERNANCEOBJECTVOTE -- Received unrequested vote object: %s, hash: %s, peer = %d\n",
|
||||||
vote.ToString(), strHash, pfrom->GetId());
|
vote.ToString(), strHash, pfrom->GetId());
|
||||||
|
@ -45,9 +45,6 @@ void CInstantSend::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataSt
|
|||||||
if(fLiteMode) return; // disable all Dash specific functionality
|
if(fLiteMode) return; // disable all Dash specific functionality
|
||||||
if(!sporkManager.IsSporkActive(SPORK_2_INSTANTSEND_ENABLED)) return;
|
if(!sporkManager.IsSporkActive(SPORK_2_INSTANTSEND_ENABLED)) return;
|
||||||
|
|
||||||
// Ignore any InstantSend messages until masternode list is synced
|
|
||||||
if(!masternodeSync.IsMasternodeListSynced()) return;
|
|
||||||
|
|
||||||
// NOTE: NetMsgType::TXLOCKREQUEST is handled via ProcessMessage() in main.cpp
|
// NOTE: NetMsgType::TXLOCKREQUEST is handled via ProcessMessage() in main.cpp
|
||||||
|
|
||||||
if (strCommand == NetMsgType::TXLOCKVOTE) // InstantSend Transaction Lock Consensus Votes
|
if (strCommand == NetMsgType::TXLOCKVOTE) // InstantSend Transaction Lock Consensus Votes
|
||||||
@ -57,6 +54,14 @@ void CInstantSend::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataSt
|
|||||||
CTxLockVote vote;
|
CTxLockVote vote;
|
||||||
vRecv >> vote;
|
vRecv >> vote;
|
||||||
|
|
||||||
|
|
||||||
|
uint256 nVoteHash = vote.GetHash();
|
||||||
|
|
||||||
|
pfrom->setAskFor.erase(nVoteHash);
|
||||||
|
|
||||||
|
// Ignore any InstantSend messages until masternode list is synced
|
||||||
|
if(!masternodeSync.IsMasternodeListSynced()) return;
|
||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
if (pwalletMain)
|
if (pwalletMain)
|
||||||
@ -64,10 +69,6 @@ void CInstantSend::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataSt
|
|||||||
#endif
|
#endif
|
||||||
LOCK(cs_instantsend);
|
LOCK(cs_instantsend);
|
||||||
|
|
||||||
uint256 nVoteHash = vote.GetHash();
|
|
||||||
|
|
||||||
pfrom->setAskFor.erase(nVoteHash);
|
|
||||||
|
|
||||||
if(mapTxLockVotes.count(nVoteHash)) return;
|
if(mapTxLockVotes.count(nVoteHash)) return;
|
||||||
mapTxLockVotes.insert(std::make_pair(nVoteHash, vote));
|
mapTxLockVotes.insert(std::make_pair(nVoteHash, vote));
|
||||||
|
|
||||||
|
@ -305,9 +305,6 @@ int CMasternodePayments::GetMinMasternodePaymentsProto() {
|
|||||||
|
|
||||||
void CMasternodePayments::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv, CConnman& connman)
|
void CMasternodePayments::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv, CConnman& connman)
|
||||||
{
|
{
|
||||||
// Ignore any payments messages until masternode list is synced
|
|
||||||
if(!masternodeSync.IsMasternodeListSynced()) return;
|
|
||||||
|
|
||||||
if(fLiteMode) return; // disable all Dash specific functionality
|
if(fLiteMode) return; // disable all Dash specific functionality
|
||||||
|
|
||||||
if (strCommand == NetMsgType::MASTERNODEPAYMENTSYNC) { //Masternode Payments Request Sync
|
if (strCommand == NetMsgType::MASTERNODEPAYMENTSYNC) { //Masternode Payments Request Sync
|
||||||
@ -342,6 +339,11 @@ void CMasternodePayments::ProcessMessage(CNode* pfrom, std::string& strCommand,
|
|||||||
|
|
||||||
pfrom->setAskFor.erase(nHash);
|
pfrom->setAskFor.erase(nHash);
|
||||||
|
|
||||||
|
// TODO: clear setAskFor for MSG_MASTERNODE_PAYMENT_BLOCK too
|
||||||
|
|
||||||
|
// Ignore any payments messages until masternode list is synced
|
||||||
|
if(!masternodeSync.IsMasternodeListSynced()) return;
|
||||||
|
|
||||||
{
|
{
|
||||||
LOCK(cs_mapMasternodePaymentVotes);
|
LOCK(cs_mapMasternodePaymentVotes);
|
||||||
if(mapMasternodePaymentVotes.count(nHash)) {
|
if(mapMasternodePaymentVotes.count(nHash)) {
|
||||||
|
@ -771,7 +771,6 @@ std::pair<CService, std::set<uint256> > CMasternodeMan::PopScheduledMnbRequestCo
|
|||||||
void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv, CConnman& connman)
|
void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv, CConnman& connman)
|
||||||
{
|
{
|
||||||
if(fLiteMode) return; // disable all Dash specific functionality
|
if(fLiteMode) return; // disable all Dash specific functionality
|
||||||
if(!masternodeSync.IsBlockchainSynced()) return;
|
|
||||||
|
|
||||||
if (strCommand == NetMsgType::MNANNOUNCE) { //Masternode Broadcast
|
if (strCommand == NetMsgType::MNANNOUNCE) { //Masternode Broadcast
|
||||||
|
|
||||||
@ -780,6 +779,8 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
|
|||||||
|
|
||||||
pfrom->setAskFor.erase(mnb.GetHash());
|
pfrom->setAskFor.erase(mnb.GetHash());
|
||||||
|
|
||||||
|
if(!masternodeSync.IsBlockchainSynced()) return;
|
||||||
|
|
||||||
LogPrint("masternode", "MNANNOUNCE -- Masternode announce, masternode=%s\n", mnb.vin.prevout.ToStringShort());
|
LogPrint("masternode", "MNANNOUNCE -- Masternode announce, masternode=%s\n", mnb.vin.prevout.ToStringShort());
|
||||||
|
|
||||||
int nDos = 0;
|
int nDos = 0;
|
||||||
@ -803,6 +804,8 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
|
|||||||
|
|
||||||
pfrom->setAskFor.erase(nHash);
|
pfrom->setAskFor.erase(nHash);
|
||||||
|
|
||||||
|
if(!masternodeSync.IsBlockchainSynced()) return;
|
||||||
|
|
||||||
LogPrint("masternode", "MNPING -- Masternode ping, masternode=%s\n", mnp.vin.prevout.ToStringShort());
|
LogPrint("masternode", "MNPING -- Masternode ping, masternode=%s\n", mnp.vin.prevout.ToStringShort());
|
||||||
|
|
||||||
// Need LOCK2 here to ensure consistent locking order because the CheckAndUpdate call below locks cs_main
|
// Need LOCK2 here to ensure consistent locking order because the CheckAndUpdate call below locks cs_main
|
||||||
@ -909,6 +912,10 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
|
|||||||
CMasternodeVerification mnv;
|
CMasternodeVerification mnv;
|
||||||
vRecv >> mnv;
|
vRecv >> mnv;
|
||||||
|
|
||||||
|
pfrom->setAskFor.erase(mnv.GetHash());
|
||||||
|
|
||||||
|
if(!masternodeSync.IsMasternodeListSynced()) return;
|
||||||
|
|
||||||
if(mnv.vchSig1.empty()) {
|
if(mnv.vchSig1.empty()) {
|
||||||
// CASE 1: someone asked me to verify myself /IP we are using/
|
// CASE 1: someone asked me to verify myself /IP we are using/
|
||||||
SendVerifyReply(pfrom, mnv, connman);
|
SendVerifyReply(pfrom, mnv, connman);
|
||||||
|
Loading…
Reference in New Issue
Block a user