Fix Vote iteration bug (#1290)

* Fix Vote iteration bug

* Fix order of statements
This commit is contained in:
Tim Flynn 2017-01-29 14:09:21 -05:00 committed by UdjinM6
parent 60409df822
commit 04ed5db62c

View File

@ -173,12 +173,14 @@ void CInstantSend::Vote(CTxLockCandidate& txLockCandidate)
if(n == -1) { if(n == -1) {
LogPrint("instantsend", "CInstantSend::Vote -- Unknown Masternode %s\n", activeMasternode.vin.prevout.ToStringShort()); LogPrint("instantsend", "CInstantSend::Vote -- Unknown Masternode %s\n", activeMasternode.vin.prevout.ToStringShort());
++itOutpointLock;
continue; continue;
} }
int nSignaturesTotal = COutPointLock::SIGNATURES_TOTAL; int nSignaturesTotal = COutPointLock::SIGNATURES_TOTAL;
if(n > nSignaturesTotal) { if(n > nSignaturesTotal) {
LogPrint("instantsend", "CInstantSend::Vote -- Masternode not in the top %d (%d)\n", nSignaturesTotal, n); LogPrint("instantsend", "CInstantSend::Vote -- Masternode not in the top %d (%d)\n", nSignaturesTotal, n);
++itOutpointLock;
continue; continue;
} }
@ -202,7 +204,10 @@ void CInstantSend::Vote(CTxLockCandidate& txLockCandidate)
} }
} }
} }
if(fAlreadyVoted) continue; // skip to the next outpoint if(fAlreadyVoted) {
++itOutpointLock;
continue; // skip to the next outpoint
}
// we haven't voted for this outpoint yet, let's try to do this now // we haven't voted for this outpoint yet, let's try to do this now
CTxLockVote vote(txHash, itOutpointLock->first, activeMasternode.vin.prevout); CTxLockVote vote(txHash, itOutpointLock->first, activeMasternode.vin.prevout);