Fix rewards error check

This commit is contained in:
jl777
2018-08-11 09:22:26 -11:00
parent d043ec4f27
commit 674e0bbebb

View File

@@ -182,7 +182,7 @@ bool RewardsExactAmounts(struct CCcontract_info *cp,Eval *eval,const CTransactio
}
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");
}
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");
amount = vinTx.vout[0].nValue;
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;
else if ( tx.vout[1].nValue > amount+reward )
return eval->Invalid("unlock tx vout.1 isnt amount+reward");