@@ -39,8 +39,7 @@ void ProcessMessageMasternodePayments(CNode* pfrom, std::string& strCommand, CDa
39
39
else if (strCommand == " mnw" ) { // Masternode Payments Declare Winner
40
40
// this is required in litemode
41
41
CMasternodePaymentWinner winner;
42
- int a = 0 ;
43
- vRecv >> winner >> a;
42
+ vRecv >> winner;
44
43
45
44
if (chainActive.Tip () == NULL ) return ;
46
45
@@ -387,7 +386,7 @@ bool CMasternodePayments::ProcessBlock(int nBlockHeight)
387
386
{
388
387
if (!enabled) return false ;
389
388
CMasternodePaymentWinner newWinner;
390
- int nEnabled = mnodeman.CountEnabled ();
389
+ int nMinimumAge = mnodeman.CountEnabled ();
391
390
392
391
uint256 hash;
393
392
if (!GetBlockHash (hash, nBlockHeight-10 )) return false ;
@@ -403,23 +402,24 @@ bool CMasternodePayments::ProcessBlock(int nBlockHeight)
403
402
vecLastPayments.push_back (winner.vin );
404
403
}
405
404
405
+
406
406
// pay to the oldest MN that still had no payment but its input is old enough and it was active long enough
407
407
CMasternode *pmn = mnodeman.FindOldestNotInVec (vecLastPayments);
408
- if (pmn != NULL && pmn-> GetMasternodeInputAge () > nEnabled && pmn-> lastTimeSeen - pmn-> sigTime > nEnabled * 2.5 * 60 )
408
+ if (pmn != NULL )
409
409
{
410
410
newWinner.score = 0 ;
411
411
newWinner.nBlockHeight = nBlockHeight;
412
412
newWinner.vin = pmn->vin ;
413
413
414
- if (pmn->donationPercentage > 0 && nHash % 100 > ( pmn->donationPercentage - 100 ) ){
414
+ if (pmn->donationPercentage > 0 && nHash % 100 > pmn->donationPercentage ){
415
415
newWinner.payee .SetDestination (pmn->pubkey .GetID ());
416
416
} else {
417
417
newWinner.payee .SetDestination (pmn->donationAddress .GetID ());
418
418
}
419
419
}
420
420
421
421
// if we can't find new MN to get paid, pick first active MN counting back from the end of vecLastPayments list
422
- if (newWinner.nBlockHeight == 0 && nEnabled > 0 )
422
+ if (newWinner.nBlockHeight == 0 && nMinimumAge > 0 )
423
423
{
424
424
BOOST_REVERSE_FOREACH (CTxIn& vinLP, vecLastPayments)
425
425
{
@@ -433,7 +433,7 @@ bool CMasternodePayments::ProcessBlock(int nBlockHeight)
433
433
newWinner.nBlockHeight = nBlockHeight;
434
434
newWinner.vin = pmn->vin ;
435
435
436
- if (pmn->donationPercentage > 0 && nHash % 100 > ( pmn->donationPercentage - 100 ) ){
436
+ if (pmn->donationPercentage > 0 && nHash % 100 < pmn->donationPercentage ){
437
437
newWinner.payee .SetDestination (pmn->pubkey .GetID ());
438
438
} else {
439
439
newWinner.payee .SetDestination (pmn->donationAddress .GetID ());
@@ -472,10 +472,9 @@ void CMasternodePayments::Relay(CMasternodePaymentWinner& winner)
472
472
473
473
void CMasternodePayments::Sync (CNode* node)
474
474
{
475
- int a = 0 ;
476
475
BOOST_FOREACH (CMasternodePaymentWinner& winner, vWinning)
477
476
if (winner.nBlockHeight >= chainActive.Tip ()->nHeight -10 && winner.nBlockHeight <= chainActive.Tip ()->nHeight + 20 )
478
- node->PushMessage (" mnw" , winner, a );
477
+ node->PushMessage (" mnw" , winner);
479
478
}
480
479
481
480
0 commit comments