diff --git a/src/cc/CCtx.cpp b/src/cc/CCtx.cpp index c559f100e..b59dc020b 100644 --- a/src/cc/CCtx.cpp +++ b/src/cc/CCtx.cpp @@ -203,7 +203,7 @@ uint64_t CCutxovalue(char *coinaddr,uint256 utxotxid,int32_t utxovout) uint64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,uint64_t total,int32_t maxinputs) { - int32_t vout,j,n = 0; uint64_t nValue,totalinputs = 0; uint256 txid; std::vector vecOutputs; + int32_t vout,j,n = 0; uint64_t nValue,totalinputs = 0; uint256 txid,hashBlock; std::vector vecOutputs; #ifdef ENABLE_WALLET const CKeyStore& keystore = *pwalletMain; assert(pwalletMain != NULL); @@ -220,12 +220,15 @@ uint64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,uint64_t total,in break; if ( j != mtx.vin.size() ) continue; - mtx.vin.push_back(CTxIn(txid,vout,CScript())); - nValue = out.tx->vout[out.i].nValue; - totalinputs += nValue; - n++; - if ( totalinputs >= total || n >= maxinputs ) - break; + if ( GetTransaction(txid,tx,hashBlock,false) != 0 && tx.IsCoinBase() == 0 ) + { + mtx.vin.push_back(CTxIn(txid,vout,CScript())); + nValue = out.tx->vout[out.i].nValue; + totalinputs += nValue; + n++; + if ( totalinputs >= total || n >= maxinputs ) + break; + } } } if ( totalinputs >= total ) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index ebd8e4aff..47070f3a3 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -513,9 +513,10 @@ bool DiceValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction &tx) case 'L': case 'W': case 'T': - //vin.0: betTx CC vout.0 entropy from bet - //vin.1: betTx CC vout.1 bet amount from bet - //vin.2+: funding CC vout.0 from 'F', 'E', 'W', 'L' or 'T' + //vin.0: normal input + //vin.1: betTx CC vout.0 entropy from bet + //vin.2: betTx CC vout.1 bet amount from bet + //vin.3+: funding CC vout.0 from 'F', 'E', 'W', 'L' or 'T' //vout.1: tag to owner address for entropy funds preventCCvouts = 1; DiceAmounts(inputs,outputs,cp,eval,tx);