diff --git a/src/main.cpp b/src/main.cpp index 5a17873abb..4781ed3844 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3945,17 +3945,17 @@ bool static AlreadyHave(const CInv& inv) case MSG_SPORK: return mapSporks.count(inv.hash); case MSG_MASTERNODE_WINNER: - return true; // mapMasternodePayeeVotes.count(inv.hash); + return mapMasternodePayeeVotes.count(inv.hash); case MSG_MASTERNODE_SCANNING_ERROR: return mapMasternodeScanningErrors.count(inv.hash); case MSG_BUDGET_VOTE: - return mapMasternodeBudgetVotes.count(inv.hash); + return mapSeenMasternodeBudgetVotes.count(inv.hash); case MSG_BUDGET_PROPOSAL: - return mapMasternodeBudgetProposals.count(inv.hash); + return mapSeenMasternodeBudgetProposals.count(inv.hash); case MSG_BUDGET_FINALIZED_VOTE: - return mapFinalizedBudgetVotes.count(inv.hash); + return mapSeenFinalizedBudgetVotes.count(inv.hash); case MSG_BUDGET_FINALIZED: - return mapFinalizedBudgets.count(inv.hash); + return mapSeenFinalizedBudgets.count(inv.hash); case MSG_MASTERNODE_ANNOUNCE: return mapSeenMasternodeBroadcast.count(inv.hash); case MSG_MASTERNODE_PING: @@ -4130,40 +4130,40 @@ void static ProcessGetData(CNode* pfrom) } if (!pushed && inv.type == MSG_BUDGET_VOTE) { - if(mapMasternodeBudgetVotes.count(inv.hash)){ + if(mapSeenMasternodeBudgetVotes.count(inv.hash)){ CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss.reserve(1000); - ss << mapMasternodeBudgetVotes[inv.hash]; + ss << mapSeenMasternodeBudgetVotes[inv.hash]; pfrom->PushMessage("mvote", ss); pushed = true; } } if (!pushed && inv.type == MSG_BUDGET_PROPOSAL) { - if(mapMasternodeBudgetProposals.count(inv.hash)){ + if(mapSeenMasternodeBudgetProposals.count(inv.hash)){ CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss.reserve(1000); - ss << mapMasternodeBudgetProposals[inv.hash]; + ss << mapSeenMasternodeBudgetProposals[inv.hash]; pfrom->PushMessage("mprop", ss); pushed = true; } } if (!pushed && inv.type == MSG_BUDGET_FINALIZED_VOTE) { - if(mapFinalizedBudgetVotes.count(inv.hash)){ + if(mapSeenFinalizedBudgetVotes.count(inv.hash)){ CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss.reserve(1000); - ss << mapFinalizedBudgetVotes[inv.hash]; + ss << mapSeenFinalizedBudgetVotes[inv.hash]; pfrom->PushMessage("fbvote", ss); pushed = true; } } if (!pushed && inv.type == MSG_BUDGET_FINALIZED) { - if(mapFinalizedBudgets.count(inv.hash)){ + if(mapSeenFinalizedBudgets.count(inv.hash)){ CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss.reserve(1000); - ss << mapFinalizedBudgets[inv.hash]; + ss << mapSeenFinalizedBudgets[inv.hash]; pfrom->PushMessage("fbs", ss); pushed = true; } diff --git a/src/masternode-budget.cpp b/src/masternode-budget.cpp index 609bcebb79..1d6ee8a06d 100644 --- a/src/masternode-budget.cpp +++ b/src/masternode-budget.cpp @@ -14,10 +14,10 @@ CBudgetManager budget; CCriticalSection cs_budget; -std::map mapMasternodeBudgetProposals; -std::map mapMasternodeBudgetVotes; -std::map mapFinalizedBudgets; -std::map mapFinalizedBudgetVotes; +std::map mapSeenMasternodeBudgetProposals; +std::map mapSeenMasternodeBudgetVotes; +std::map mapSeenFinalizedBudgets; +std::map mapSeenFinalizedBudgetVotes; int GetBudgetPaymentCycleBlocks(){ if(Params().NetworkID() == CBaseChainParams::MAIN) return 16616; //(60*24*30)/2.6 @@ -355,7 +355,7 @@ void CBudgetManager::ProcessMessage(CNode* pfrom, std::string& strCommand, CData CBudgetProposalBroadcast prop; vRecv >> prop; - if(mapMasternodeBudgetProposals.count(prop.GetHash())){ + if(mapSeenMasternodeBudgetProposals.count(prop.GetHash())){ return; } @@ -376,7 +376,7 @@ void CBudgetManager::ProcessMessage(CNode* pfrom, std::string& strCommand, CData return; } - mapMasternodeBudgetProposals.insert(make_pair(prop.GetHash(), prop)); + mapSeenMasternodeBudgetProposals.insert(make_pair(prop.GetHash(), prop)); if(IsSyncingMasternodeAssets() || pmn->nVotedTimes < 100){ CBudgetProposal p(prop); budget.AddProposal(p); @@ -393,7 +393,7 @@ void CBudgetManager::ProcessMessage(CNode* pfrom, std::string& strCommand, CData CBudgetVote vote; vRecv >> vote; - if(mapMasternodeBudgetVotes.count(vote.GetHash())){ + if(mapSeenMasternodeBudgetVotes.count(vote.GetHash())){ return; } @@ -409,7 +409,7 @@ void CBudgetManager::ProcessMessage(CNode* pfrom, std::string& strCommand, CData return; } - mapMasternodeBudgetVotes.insert(make_pair(vote.GetHash(), vote)); + mapSeenMasternodeBudgetVotes.insert(make_pair(vote.GetHash(), vote)); if(IsSyncingMasternodeAssets() || pmn->nVotedTimes < 100){ budget.UpdateProposal(vote); vote.Relay(); @@ -426,7 +426,7 @@ void CBudgetManager::ProcessMessage(CNode* pfrom, std::string& strCommand, CData printf("34\n"); - if(mapFinalizedBudgets.count(prop.GetHash())){ + if(mapSeenFinalizedBudgets.count(prop.GetHash())){ return; } @@ -453,7 +453,7 @@ void CBudgetManager::ProcessMessage(CNode* pfrom, std::string& strCommand, CData return; } - mapFinalizedBudgets.insert(make_pair(prop.GetHash(), prop)); + mapSeenFinalizedBudgets.insert(make_pair(prop.GetHash(), prop)); if(IsSyncingMasternodeAssets() || pmn->nVotedTimes < 100){ printf("42\n"); @@ -474,7 +474,7 @@ void CBudgetManager::ProcessMessage(CNode* pfrom, std::string& strCommand, CData CFinalizedBudgetVote vote; vRecv >> vote; - if(mapFinalizedBudgetVotes.count(vote.GetHash())){ + if(mapSeenFinalizedBudgetVotes.count(vote.GetHash())){ return; } @@ -490,7 +490,7 @@ void CBudgetManager::ProcessMessage(CNode* pfrom, std::string& strCommand, CData return; } - mapFinalizedBudgetVotes.insert(make_pair(vote.GetHash(), vote)); + mapSeenFinalizedBudgetVotes.insert(make_pair(vote.GetHash(), vote)); if(IsSyncingMasternodeAssets() || pmn->nVotedTimes < 100){ budget.UpdateFinalizedBudget(vote); vote.Relay(); diff --git a/src/masternode-budget.h b/src/masternode-budget.h index cf03943d40..1de042e073 100644 --- a/src/masternode-budget.h +++ b/src/masternode-budget.h @@ -29,10 +29,10 @@ class CBudgetVote; #define VOTE_YES 1 #define VOTE_NO 2 -extern std::map mapMasternodeBudgetProposals; -extern std::map mapMasternodeBudgetVotes; -extern std::map mapFinalizedBudgets; -extern std::map mapFinalizedBudgetVotes; +extern std::map mapSeenMasternodeBudgetProposals; +extern std::map mapSeenMasternodeBudgetVotes; +extern std::map mapSeenFinalizedBudgets; +extern std::map mapSeenFinalizedBudgetVotes; extern CBudgetManager budget; @@ -123,10 +123,10 @@ public: template inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { - READWRITE(mapMasternodeBudgetProposals); - READWRITE(mapMasternodeBudgetVotes); - READWRITE(mapFinalizedBudgets); - READWRITE(mapMasternodeBudgetVotes); + READWRITE(mapSeenMasternodeBudgetProposals); + READWRITE(mapSeenMasternodeBudgetVotes); + READWRITE(mapSeenFinalizedBudgets); + READWRITE(mapSeenFinalizedBudgetVotes); READWRITE(mapProposals); READWRITE(mapFinalizedBudgets); diff --git a/src/masternode-payments.cpp b/src/masternode-payments.cpp index 147fe1d20e..051db59830 100644 --- a/src/masternode-payments.cpp +++ b/src/masternode-payments.cpp @@ -98,6 +98,7 @@ void CMasternodePayments::ProcessMessageMasternodePayments(CNode* pfrom, std::st if(fDebug) LogPrintf("mnw - winning vote - Addr %s Height %d bestHeight %d\n", address2.ToString().c_str(), winner.nBlockHeight, chainActive.Tip()->nHeight); + mapMasternodePayeeVotes.insert(make_pair(winner.GetHash(), winner)); if(masternodePayments.AddWinningMasternode(winner)){ winner.Relay(); } diff --git a/src/rpcmasternode-budget.cpp b/src/rpcmasternode-budget.cpp index 0bac700b6b..0821b7e6c7 100644 --- a/src/rpcmasternode-budget.cpp +++ b/src/rpcmasternode-budget.cpp @@ -1,5 +1,4 @@ -// Copyright (c) 2010 Satoshi Nakamoto -// Copyright (c) 2009-2012 The Bitcoin developers +// Copyright (c) 2014-2015 The Dash Developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -118,7 +117,7 @@ Value mnbudget(const Array& params, bool fHelp) if(!prop.Sign(keyMasternode, pubKeyMasternode)){ return "Failure to sign."; } - mapMasternodeBudgetProposals.insert(make_pair(prop.GetHash(), prop)); + mapSeenMasternodeBudgetProposals.insert(make_pair(prop.GetHash(), prop)); prop.Relay(); CBudgetVote vote(pmn->vin, prop.GetHash(), nVote); @@ -126,7 +125,7 @@ Value mnbudget(const Array& params, bool fHelp) return "Failure to sign."; } - mapMasternodeBudgetVotes.insert(make_pair(vote.GetHash(), vote)); + mapSeenMasternodeBudgetVotes.insert(make_pair(vote.GetHash(), vote)); vote.Relay(); success++; @@ -193,7 +192,7 @@ Value mnbudget(const Array& params, bool fHelp) return "Failure to sign."; } - mapMasternodeBudgetProposals.insert(make_pair(prop.GetHash(), prop)); + mapSeenMasternodeBudgetProposals.insert(make_pair(prop.GetHash(), prop)); prop.Relay(); budget.AddProposal(prop); @@ -202,7 +201,7 @@ Value mnbudget(const Array& params, bool fHelp) return "Failure to sign."; } - mapMasternodeBudgetVotes.insert(make_pair(vote.GetHash(), vote)); + mapSeenMasternodeBudgetVotes.insert(make_pair(vote.GetHash(), vote)); vote.Relay(); budget.UpdateProposal(vote); @@ -362,7 +361,7 @@ Value mnfinalbudget(const Array& params, bool fHelp) if(!prop.IsValid()) return "Invalid prop (are all the hashes correct?)"; - mapFinalizedBudgets.insert(make_pair(prop.GetHash(), prop)); + mapSeenFinalizedBudgets.insert(make_pair(prop.GetHash(), prop)); prop.Relay(); budget.AddFinalizedBudget(prop); @@ -371,7 +370,7 @@ Value mnfinalbudget(const Array& params, bool fHelp) return "Failure to sign."; } - mapFinalizedBudgetVotes.insert(make_pair(vote.GetHash(), vote)); + mapSeenFinalizedBudgetVotes.insert(make_pair(vote.GetHash(), vote)); vote.Relay(); budget.UpdateFinalizedBudget(vote); @@ -426,7 +425,7 @@ Value mnfinalbudget(const Array& params, bool fHelp) continue; } - mapFinalizedBudgetVotes.insert(make_pair(vote.GetHash(), vote)); + mapSeenFinalizedBudgetVotes.insert(make_pair(vote.GetHash(), vote)); vote.Relay(); budget.UpdateFinalizedBudget(vote); @@ -459,7 +458,7 @@ Value mnfinalbudget(const Array& params, bool fHelp) return "Failure to sign."; } - mapFinalizedBudgetVotes.insert(make_pair(vote.GetHash(), vote)); + mapSeenFinalizedBudgetVotes.insert(make_pair(vote.GetHash(), vote)); vote.Relay(); budget.UpdateFinalizedBudget(vote);