From 43b91cca463f0d0f070c3b0d4012e85ea7ca1723 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 28 Jul 2018 00:47:41 -1100 Subject: [PATCH] Test --- src/cc/CCutils.cpp | 5 +++-- src/cc/rewards.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cc/CCutils.cpp b/src/cc/CCutils.cpp index af92b69a3..7807e0e27 100644 --- a/src/cc/CCutils.cpp +++ b/src/cc/CCutils.cpp @@ -270,12 +270,13 @@ bool ProcessCC(struct CCcontract_info *cp,Eval* eval, std::vector 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); } diff --git a/src/cc/rewards.cpp b/src/cc/rewards.cpp index 1a94f34ef..cc174804f 100644 --- a/src/cc/rewards.cpp +++ b/src/cc/rewards.cpp @@ -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;