only vote when in the top X nodes

This commit is contained in:
Evan Duffield 2015-02-05 21:41:17 -07:00
parent 6149e55710
commit 76e36bfbea

View File

@ -249,10 +249,25 @@ void DoConsensusVote(CTransaction& tx, int64_t nBlockHeight)
{
if(!fMasterNode) return;
int n = GetMasternodeRank(activeMasternode.vin, nBlockHeight, MIN_INSTANTX_PROTO_VERSION);
if(n == -1)
{
LogPrintf("InstantX::DoConsensusVote - Unknown Masternode\n");
return;
}
if(n > INSTANTX_SIGNATURES_TOTAL)
{
LogPrintf("InstantX::DoConsensusVote - Masternode not in the top %d (%d)\n", INSTANTX_SIGNATURES_TOTAL, n);
return;
}
/*
nBlockHeight calculated from the transaction is the authoritive source
*/
LogPrintf("InstantX::DoConsensusVote - In the top %d (%d)\n", INSTANTX_SIGNATURES_TOTAL, n);
CConsensusVote ctx;
ctx.vinMasternode = activeMasternode.vin;
ctx.txHash = tx.GetHash();