Skip to content

Commit

Permalink
Fixed RemainingPayments display bug
Browse files Browse the repository at this point in the history
- When proposal hasn't started yet, remaining payment is calculated incorrectly.
  • Loading branch information
Evan Duffield committed Jul 23, 2015
1 parent 35cc21e commit f727b2d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/masternode-budget.cpp
Expand Up @@ -1215,7 +1215,11 @@ int CBudgetProposal::GetTotalPaymentCount()

int CBudgetProposal::GetRemainingPaymentCount()
{
return (GetBlockEndCycle() - GetBlockCurrentCycle()) / GetBudgetPaymentCycleBlocks();
// If this budget starts in the future, this value will be wrong
int nPayments = (GetBlockEndCycle() - GetBlockCurrentCycle()) / GetBudgetPaymentCycleBlocks();
int nTotal = (GetBlockEndCycle() - GetBlockStartCycle()) / GetBudgetPaymentCycleBlocks();
// Take the lowest value
return (nPayments <= nTotal ? nPayments : nTotal);
}

CBudgetProposalBroadcast::CBudgetProposalBroadcast()
Expand Down

0 comments on commit f727b2d

Please sign in to comment.