Added IsTransactionValid for finalized budgets
This commit is contained in:
parent
fc54241441
commit
017217f423
@ -1457,28 +1457,32 @@ bool CFinalizedBudget::IsValid(bool fCheckCollateral)
|
|||||||
|
|
||||||
bool CFinalizedBudget::IsTransactionValid(const CTransaction& txNew, int nBlockHeight)
|
bool CFinalizedBudget::IsTransactionValid(const CTransaction& txNew, int nBlockHeight)
|
||||||
{
|
{
|
||||||
// TODO:
|
int i = nBlockHeight - GetBlockStart();
|
||||||
// BOOST_FOREACH(CMasternodePayee& payee, vecPayments)
|
if(i < 0) {
|
||||||
// {
|
LogPrintf("CFinalizedBudget::IsTransactionValid - Invalid block - height:%d : start:%d\n", nBlockHeight, GetBlockStart());
|
||||||
// bool found = false;
|
return false;
|
||||||
// BOOST_FOREACH(CTxOut out, txNew.vout)
|
}
|
||||||
// {
|
|
||||||
// if(payee.scriptPubKey == out.scriptPubKey && payee.nValue == out.nValue)
|
|
||||||
// found = true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if(payee.nVotes >= MNPAYMENTS_SIGNATURES_REQUIRED && !found){
|
if(i > (int)vecProposals.size()-1) {
|
||||||
|
LogPrintf("CFinalizedBudget::IsTransactionValid - Invalid block - i:%d : size:%d\n", i, (int)vecProposals.size()-1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// CTxDestination address1;
|
bool found = false;
|
||||||
// ExtractDestination(payee.scriptPubKey, address1);
|
BOOST_FOREACH(CTxOut out, txNew.vout)
|
||||||
// CBitcoinAddress address2(address1);
|
{
|
||||||
|
if(vecProposals[i].payee == out.scriptPubKey && vecProposals[i].nAmount == out.nValue)
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
if(!found) {
|
||||||
|
CTxDestination address1;
|
||||||
|
ExtractDestination(vecProposals[i].payee, address1);
|
||||||
|
CBitcoinAddress address2(address1);
|
||||||
|
|
||||||
// LogPrintf("CFinalizedBudget::IsTransactionValid - Missing required payment - %s:%d\n", address2.ToString().c_str(), payee.nValue);
|
LogPrintf("CFinalizedBudget::IsTransactionValid - Missing required payment - %s:%d\n", address2.ToString().c_str(), vecProposals[i].nAmount);
|
||||||
// return false;
|
}
|
||||||
// }
|
|
||||||
// }
|
return found;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFinalizedBudget::SubmitVote()
|
void CFinalizedBudget::SubmitVote()
|
||||||
|
Loading…
Reference in New Issue
Block a user