diff --git a/src/cc/CCassetstx.cpp b/src/cc/CCassetstx.cpp index 51668eda8..7d55b85ff 100644 --- a/src/cc/CCassetstx.cpp +++ b/src/cc/CCassetstx.cpp @@ -15,9 +15,6 @@ #include "CCassets.h" -// need allassets -// find asset - 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; @@ -35,7 +32,7 @@ int64_t AddAssetInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubK continue; if ( GetTransaction(txid,vintx,hashBlock,false) != 0 ) { - if ( (nValue= IsAssetvout(price,origpubkey,vintx,vout,assetid)) > 0 ) + if ( (nValue= IsAssetvout(price,origpubkey,vintx,vout,assetid)) > 0 && myIsutxo_spentinmempool(txid,vout) == 0 ) { if ( total != 0 && maxinputs != 0 ) mtx.vin.push_back(CTxIn(txid,vout,CScript())); diff --git a/src/cc/auction.cpp b/src/cc/auction.cpp index cf3ae601a..7d8512ede 100644 --- a/src/cc/auction.cpp +++ b/src/cc/auction.cpp @@ -73,6 +73,7 @@ bool AuctionExactAmounts(struct CCcontract_info *cp,Eval* eval,const CTransactio bool AuctionValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx) { int32_t numvins,numvouts,preventCCvins,preventCCvouts,i; bool retval; + return(false); // reject any auction CC for now numvins = tx.vin.size(); numvouts = tx.vout.size(); preventCCvins = preventCCvouts = -1; diff --git a/src/cc/faucet.cpp b/src/cc/faucet.cpp index 51d7f2f6f..570f1539a 100644 --- a/src/cc/faucet.cpp +++ b/src/cc/faucet.cpp @@ -126,20 +126,21 @@ bool FaucetValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx uint64_t AddFaucetInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey pk,uint64_t total,int32_t maxinputs) { - char coinaddr[64]; uint64_t nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector origpubkey; CTransaction vintx; int32_t n = 0; + char coinaddr[64]; uint64_t nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector origpubkey; CTransaction vintx; int32_t 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; - // prevent dup + vout = (int32_t)it->first.index); + // no need to prevent dup if ( GetTransaction(txid,vintx,hashBlock,false) != 0 ) { - if ( (nValue= IsFaucetvout(cp,vintx,(int32_t)it->first.index)) > 1000000 ) + if ( (nValue= IsFaucetvout(cp,vintx,vout) > 1000000 && myIsutxo_spentinmempool(txid,vout) == 0 ) { if ( total != 0 && maxinputs != 0 ) - mtx.vin.push_back(CTxIn(txid,(int32_t)it->first.index,CScript())); + mtx.vin.push_back(CTxIn(txid,vout,CScript())); nValue = it->second.satoshis; totalinputs += nValue; n++; diff --git a/src/cc/fsm.cpp b/src/cc/fsm.cpp index 201535992..e3e112bf6 100644 --- a/src/cc/fsm.cpp +++ b/src/cc/fsm.cpp @@ -73,6 +73,7 @@ bool FSMExactAmounts(struct CCcontract_info *cp,Eval* eval,const CTransaction &t bool FSMValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx) { int32_t numvins,numvouts,preventCCvins,preventCCvouts,i; bool retval; + return(false); // reject any FSM CC for now numvins = tx.vin.size(); numvouts = tx.vout.size(); preventCCvins = preventCCvouts = -1; diff --git a/src/cc/lotto.cpp b/src/cc/lotto.cpp index 43367ab70..0ed223c25 100644 --- a/src/cc/lotto.cpp +++ b/src/cc/lotto.cpp @@ -73,6 +73,7 @@ bool LottoExactAmounts(struct CCcontract_info *cp,Eval* eval,const CTransaction bool LottoValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx) { int32_t numvins,numvouts,preventCCvins,preventCCvouts,i; bool retval; + return(false); // reject any lotto CC for now numvins = tx.vin.size(); numvouts = tx.vout.size(); preventCCvins = preventCCvouts = -1; diff --git a/src/cc/rewards.cpp b/src/cc/rewards.cpp index a0f07aba1..afa025851 100644 --- a/src/cc/rewards.cpp +++ b/src/cc/rewards.cpp @@ -282,7 +282,7 @@ uint64_t AddRewardsInputs(CScript &scriptPubKey,int32_t fundsflag,struct CCcontr break; if ( j != mtx.vin.size() ) continue; - if ( GetTransaction(txid,tx,hashBlock,false) != 0 && tx.vout.size() > 0 && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 ) + if ( GetTransaction(txid,tx,hashBlock,false) != 0 && tx.vout.size() > 0 && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 && myIsutxo_spentinmempool(txid,vout) == 0 ) { if ( (funcid= DecodeRewardsOpRet(txid,tx.vout[tx.vout.size()-1].scriptPubKey,sbits,fundingtxid)) != 0 ) { diff --git a/src/main.h b/src/main.h index 56b439fc0..dfea318cb 100644 --- a/src/main.h +++ b/src/main.h @@ -103,9 +103,10 @@ static const unsigned int DATABASE_FLUSH_INTERVAL = 24 * 60 * 60; static const unsigned int MAX_REJECT_MESSAGE_LENGTH = 111; //static const bool DEFAULT_ADDRESSINDEX = false; +//static const bool DEFAULT_SPENTINDEX = false; #define DEFAULT_ADDRESSINDEX (GetArg("-ac_cc",0) != 0) +#define DEFAULT_SPENTINDEX (GetArg("-ac_cc",0) != 0) static const bool DEFAULT_TIMESTAMPINDEX = false; -static const bool DEFAULT_SPENTINDEX = false; static const unsigned int DEFAULT_DB_MAX_OPEN_FILES = 1000; static const bool DEFAULT_DB_COMPRESSION = true; diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 295460618..c2e486a05 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4837,6 +4837,8 @@ int32_t ensure_CCrequirements() return(-1); else if ( GetBoolArg("-addressindex", DEFAULT_ADDRESSINDEX) == 0 ) return(-1); + else if ( GetBoolArg("-spentindex", DEFAULT_SPENTINDEX) == 0 ) + return(-1); else return(0); }