mirror of
https://github.com/dashpay/dash.git
synced 2024-12-29 13:59:06 +01:00
fixed GetBudget bug
This commit is contained in:
parent
f82a028869
commit
fc33c3b963
@ -25,8 +25,8 @@ int nSubmittedFinalBudget;
|
|||||||
int GetBudgetPaymentCycleBlocks(){
|
int GetBudgetPaymentCycleBlocks(){
|
||||||
// Amount of blocks in a months period of time (using 2.6 minutes per) = (60*24*30)/2.6
|
// Amount of blocks in a months period of time (using 2.6 minutes per) = (60*24*30)/2.6
|
||||||
if(Params().NetworkID() == CBaseChainParams::MAIN) return 16616;
|
if(Params().NetworkID() == CBaseChainParams::MAIN) return 16616;
|
||||||
|
|
||||||
//for testing purposes
|
//for testing purposes
|
||||||
|
|
||||||
return 50;
|
return 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ void CBudgetManager::SubmitFinalBudget()
|
|||||||
CTxBudgetPayment txBudgetPayment;
|
CTxBudgetPayment txBudgetPayment;
|
||||||
txBudgetPayment.nProposalHash = vBudgetProposals[i]->GetHash();
|
txBudgetPayment.nProposalHash = vBudgetProposals[i]->GetHash();
|
||||||
txBudgetPayment.payee = vBudgetProposals[i]->GetPayee();
|
txBudgetPayment.payee = vBudgetProposals[i]->GetPayee();
|
||||||
txBudgetPayment.nAmount = vBudgetProposals[i]->GetAmount();
|
txBudgetPayment.nAmount = vBudgetProposals[i]->GetAllotted();
|
||||||
vecTxBudgetPayments.push_back(txBudgetPayment);
|
vecTxBudgetPayments.push_back(txBudgetPayment);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -643,15 +643,11 @@ std::vector<CBudgetProposal*> CBudgetManager::GetBudget()
|
|||||||
pbudgetProposal->GetYeas() - pbudgetProposal->GetNays() > mnodeman.CountEnabled(MIN_BUDGET_PEER_PROTO_VERSION)/10 &&
|
pbudgetProposal->GetYeas() - pbudgetProposal->GetNays() > mnodeman.CountEnabled(MIN_BUDGET_PEER_PROTO_VERSION)/10 &&
|
||||||
pbudgetProposal->IsEstablished())
|
pbudgetProposal->IsEstablished())
|
||||||
{
|
{
|
||||||
if(nTotalBudget == nBudgetAllocated){
|
if(pbudgetProposal->GetAmount() + nBudgetAllocated <= nTotalBudget) {
|
||||||
pbudgetProposal->SetAllotted(0);
|
|
||||||
} else if(pbudgetProposal->GetAmount() + nBudgetAllocated <= nTotalBudget) {
|
|
||||||
pbudgetProposal->SetAllotted(pbudgetProposal->GetAmount());
|
pbudgetProposal->SetAllotted(pbudgetProposal->GetAmount());
|
||||||
nBudgetAllocated += pbudgetProposal->GetAmount();
|
nBudgetAllocated += pbudgetProposal->GetAmount();
|
||||||
} else {
|
} else {
|
||||||
//couldn't pay for the entire budget, so it'll be partially paid.
|
pbudgetProposal->SetAllotted(0);
|
||||||
pbudgetProposal->SetAllotted(nTotalBudget - nBudgetAllocated);
|
|
||||||
nBudgetAllocated = nTotalBudget;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vBudgetProposalsRet.push_back(pbudgetProposal);
|
vBudgetProposalsRet.push_back(pbudgetProposal);
|
||||||
|
Loading…
Reference in New Issue
Block a user