This commit is contained in:
jl777
2018-07-28 00:47:41 -11:00
parent 763ec3cae7
commit 43b91cca46
2 changed files with 4 additions and 3 deletions

View File

@@ -270,12 +270,13 @@ bool ProcessCC(struct CCcontract_info *cp,Eval* eval, std::vector<uint8_t> param
int64_t CCduration(uint256 txid)
{
CTransaction tx; uint256 hashBlock; int64_t duration = 0;
CTransaction tx; uint256 hashBlock; char str[65]; int64_t duration = 0;
if ( GetTransaction(txid,tx,hashBlock,false) == 0 )
{
fprintf(stderr,"cant find duration txid\n");
fprintf(stderr,"cant find duration txid %s\n",uint256_str(str,txid));
return(0);
}
// get current nTime
return(duration);
}

View File

@@ -249,7 +249,7 @@ bool RewardsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &t
else if ( tx.vout[1].scriptPubKey != vinTx.vout[1].scriptPubKey )
return eval->Invalid("unlock tx vout.1 mismatched scriptPubKey");
amount = vinTx.vout[0].nValue;
reward = RewardsCalc(amount,txid,APR,minseconds,maxseconds,mindeposit);
reward = RewardsCalc(amount,tx.vin[0].prevout.hash,APR,minseconds,maxseconds,mindeposit);
if ( tx.vout[1].nValue > amount+reward )
return eval->Invalid("unlock tx vout.1 isnt amount+reward");
preventCCvouts = 1;