mirror of
https://github.com/dashpay/dash.git
synced 2024-12-29 13:59:06 +01:00
Test feeTX in IsValid
This commit is contained in:
parent
db080fec22
commit
21769085ec
@ -749,19 +749,14 @@ void CBudgetManager::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
|
||||
//set time we first saw this prop
|
||||
budgetProposalBroadcast.nTime = GetAdjustedTime();
|
||||
|
||||
mapSeenMasternodeBudgetProposals.insert(make_pair(budgetProposalBroadcast.GetHash(), budgetProposalBroadcast));
|
||||
|
||||
std::string strError = "";
|
||||
if(!budgetProposalBroadcast.IsValid(strError)) {
|
||||
LogPrintf("mprop - invalid budget proposal - %s\n", strError);
|
||||
return;
|
||||
}
|
||||
|
||||
mapSeenMasternodeBudgetProposals.insert(make_pair(budgetProposalBroadcast.GetHash(), budgetProposalBroadcast));
|
||||
|
||||
if(!IsBudgetCollateralValid(budgetProposalBroadcast.nFeeTXHash, budgetProposalBroadcast.GetHash(), strError)){
|
||||
LogPrintf("Proposal FeeTX is not valid - %s - %s\n", budgetProposalBroadcast.nFeeTXHash.ToString(), strError);
|
||||
return;
|
||||
}
|
||||
|
||||
CBudgetProposal budgetProposal(budgetProposalBroadcast);
|
||||
budget.AddProposal(budgetProposal);
|
||||
budgetProposalBroadcast.Relay();
|
||||
@ -818,13 +813,13 @@ void CBudgetManager::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
|
||||
return;
|
||||
}
|
||||
|
||||
mapSeenFinalizedBudgets.insert(make_pair(finalizedBudgetBroadcast.GetHash(), finalizedBudgetBroadcast));
|
||||
|
||||
if(!finalizedBudgetBroadcast.IsValid()) {
|
||||
LogPrintf("fbs - invalid finalized budget\n");
|
||||
return;
|
||||
}
|
||||
|
||||
mapSeenFinalizedBudgets.insert(make_pair(finalizedBudgetBroadcast.GetHash(), finalizedBudgetBroadcast));
|
||||
|
||||
CFinalizedBudget finalizedBudget(finalizedBudgetBroadcast);
|
||||
budget.AddFinalizedBudget(finalizedBudget);
|
||||
finalizedBudgetBroadcast.Relay();
|
||||
@ -1022,6 +1017,10 @@ bool CBudgetProposal::IsValid(std::string& strError)
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!IsBudgetCollateralValid(nFeeTXHash, GetHash(), strError)){
|
||||
return false;
|
||||
}
|
||||
|
||||
//if proposal doesn't gain traction within 2 weeks, remove it
|
||||
// nTime not being saved correctly
|
||||
// if(nTime + (60*60*24*2) < GetAdjustedTime()) {
|
||||
@ -1436,6 +1435,11 @@ bool CFinalizedBudget::IsValid()
|
||||
//can only pay out 10% of the possible coins (min value of coins)
|
||||
if(GetTotalPayout() > budget.GetTotalBudget(nBlockStart)) return false;
|
||||
|
||||
std::string strError = "";
|
||||
if(!IsBudgetCollateralValid(nFeeTXHash, GetHash(), strError)){
|
||||
return false;
|
||||
}
|
||||
|
||||
//TODO: if N cycles old, invalid, invalid
|
||||
|
||||
CBlockIndex* pindexPrev = chainActive.Tip();
|
||||
|
Loading…
Reference in New Issue
Block a user