Fix rewards error check
This commit is contained in:
@@ -182,7 +182,7 @@ bool RewardsExactAmounts(struct CCcontract_info *cp,Eval *eval,const CTransactio
|
|||||||
}
|
}
|
||||||
if ( inputs != outputs+txfee )
|
if ( inputs != outputs+txfee )
|
||||||
{
|
{
|
||||||
fprintf(stderr,"inputs %llu vs outputs %llu\n",(long long)inputs,(long long)outputs);
|
fprintf(stderr,"inputs %llu vs outputs %llu txfee %llu\n",(long long)inputs,(long long)outputs,(long long)txfee);
|
||||||
return eval->Invalid("mismatched inputs != outputs + txfee");
|
return eval->Invalid("mismatched inputs != outputs + txfee");
|
||||||
}
|
}
|
||||||
else return(true);
|
else return(true);
|
||||||
@@ -257,7 +257,7 @@ bool RewardsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &t
|
|||||||
return eval->Invalid("unlock tx vout.1 mismatched scriptPubKey");
|
return eval->Invalid("unlock tx vout.1 mismatched scriptPubKey");
|
||||||
amount = vinTx.vout[0].nValue;
|
amount = vinTx.vout[0].nValue;
|
||||||
reward = RewardsCalc(amount,tx.vin[0].prevout.hash,APR,minseconds,maxseconds,mindeposit);
|
reward = RewardsCalc(amount,tx.vin[0].prevout.hash,APR,minseconds,maxseconds,mindeposit);
|
||||||
if ( RewardsExactAmounts(cp,eval,tx,txfee+tx.vout[1].nValue+reward,sbits,fundingtxid) == 0 )
|
if ( RewardsExactAmounts(cp,eval,tx,txfee+reward,sbits,fundingtxid) == 0 )
|
||||||
return false;
|
return false;
|
||||||
else if ( tx.vout[1].nValue > amount+reward )
|
else if ( tx.vout[1].nValue > amount+reward )
|
||||||
return eval->Invalid("unlock tx vout.1 isnt amount+reward");
|
return eval->Invalid("unlock tx vout.1 isnt amount+reward");
|
||||||
|
|||||||
Reference in New Issue
Block a user