diff --git a/src/cc/CCassetstx.cpp b/src/cc/CCassetstx.cpp index 82623d4b9..a0f80dbc3 100644 --- a/src/cc/CCassetstx.cpp +++ b/src/cc/CCassetstx.cpp @@ -17,10 +17,11 @@ int64_t AddAssetInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey pk,uint256 assetid,int64_t total,int32_t maxinputs) { - char coinaddr[64]; int64_t nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector origpubkey; CTransaction vintx; int32_t j,vout,n = 0; + char coinaddr[64],destaddr[64]; int64_t nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector origpubkey; CTransaction vintx; int32_t j,vout,n = 0; std::vector > unspentOutputs; GetCCaddress(cp,coinaddr,pk); SetCCunspents(unspentOutputs,coinaddr); + for (std::vector >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++) { txid = it->first.txhash; @@ -32,6 +33,9 @@ int64_t AddAssetInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubK continue; if ( GetTransaction(txid,vintx,hashBlock,false) != 0 ) { + Getscriptaddress(destaddr,vintx.vout[vout].scriptPubKey); + if ( strcmp(destaddr,coinaddr) != 0 && strcmp(destaddr,cp->unspendableCCaddr) != 0 && strmp(destaddr,cp->unspendableaddr2) != 0 ) + continue; if ( (nValue= IsAssetvout(price,origpubkey,vintx,vout,assetid)) > 0 && myIsutxo_spentinmempool(txid,vout) == 0 ) { if ( total != 0 && maxinputs != 0 ) diff --git a/src/cc/CCutils.cpp b/src/cc/CCutils.cpp index 3a448a92c..396b3211d 100644 --- a/src/cc/CCutils.cpp +++ b/src/cc/CCutils.cpp @@ -339,6 +339,7 @@ bool ProcessCC(struct CCcontract_info *cp,Eval* eval, std::vector param //if ( txid == cp->prevtxid ) // return(true); //fprintf(stderr,"process CC %02x\n",cp->evalcode); + cp->unspendableaddr2[0] = 0; if ( paramsNull.size() != 0 ) // Don't expect params return eval->Invalid("Cannot have params"); else if ( ctx.vout.size() == 0 ) diff --git a/src/cc/gateways.cpp b/src/cc/gateways.cpp index b98b95111..5b1201eae 100644 --- a/src/cc/gateways.cpp +++ b/src/cc/gateways.cpp @@ -17,10 +17,10 @@ /* prevent duplicate bindtxid and cointxid via mempool scan + baton from mempool for oracle assets vin selector needs to filter by signable vins -loop on merkle oracle string oracles */