From 0b9d761a389d049687de516472095f3a3008eca6 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Sat, 25 Jul 2015 09:59:59 -0700 Subject: [PATCH] only take newest votes --- src/masternode-budget.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/masternode-budget.cpp b/src/masternode-budget.cpp index 08fcf3265..22c65f959 100644 --- a/src/masternode-budget.cpp +++ b/src/masternode-budget.cpp @@ -1139,6 +1139,14 @@ void CBudgetProposal::AddOrUpdateVote(CBudgetVote& vote) LOCK(cs); uint256 hash = vote.vin.prevout.GetHash(); + + if(mapVotes.count(hash)){ + if(mapVotes[hash].nTime > vote.nTime){ + if(fDebug) LogPrintf("CBudgetProposal::AddOrUpdateVote - new vote older than existing vote - %s\n", vote.GetHash().ToString()); + return; + } + } + mapVotes[hash] = vote; } @@ -1387,6 +1395,13 @@ void CFinalizedBudget::AddOrUpdateVote(CFinalizedBudgetVote& vote) LOCK(cs); uint256 hash = vote.vin.prevout.GetHash(); + if(mapVotes.count(hash)){ + if(mapVotes[hash].nTime > vote.nTime){ + if(fDebug) LogPrintf("CBudgetProposal::AddOrUpdateVote - new vote older than existing vote - %s\n", vote.GetHash().ToString()); + return; + } + } + mapVotes[hash] = vote; }