From 034198730a9dc9a02d5e946824813409df97bc7b Mon Sep 17 00:00:00 2001 From: dimxy Date: Sat, 12 Jan 2019 16:44:49 +0500 Subject: [PATCH] changed vcontractOpret in IsTokensVout remove extra param from IsTokensVout --- src/cc/CCinclude.h | 2 +- src/cc/CCtokens.cpp | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/cc/CCinclude.h b/src/cc/CCinclude.h index 4b6b437b4..c42a4799e 100644 --- a/src/cc/CCinclude.h +++ b/src/cc/CCinclude.h @@ -155,7 +155,7 @@ uint256 OraclesBatontxid(uint256 oracletxid,CPubKey pk); //int64_t AddAssetInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey pk,uint256 assetid,int64_t total,int32_t maxinputs); int64_t AddTokenCCInputs(struct CCcontract_info *cp, CMutableTransaction &mtx, CPubKey pk, uint256 tokenid, int64_t total, int32_t maxinputs); -int64_t IsTokensvout(bool goDeeper, bool checkPubkeys, struct CCcontract_info *cp, Eval* eval, std::vector &origpubkey, const CTransaction& tx, int32_t v, uint256 reftokenid, std::vector vinPubkeys); +int64_t IsTokensvout(bool goDeeper, bool checkPubkeys, struct CCcontract_info *cp, Eval* eval, /*std::vector &origpubkey,*/ const CTransaction& tx, int32_t v, uint256 reftokenid, std::vector vinPubkeys); bool DecodeHexTx(CTransaction& tx, const std::string& strHexTx); CScript EncodeAssetOpRet(uint8_t assetFuncId, uint256 tokenid, uint256 assetid2, int64_t price, std::vector voutPubkeys, std::vector origpubkey); diff --git a/src/cc/CCtokens.cpp b/src/cc/CCtokens.cpp index 266035e08..aca45fb70 100644 --- a/src/cc/CCtokens.cpp +++ b/src/cc/CCtokens.cpp @@ -365,17 +365,17 @@ int64_t IsTokensvout(bool goDeeper, bool checkPubkeys, struct CCcontract_info *c // moved opret checking to this new reusable func (dimxy): std::vector voutPubkeys; - const uint8_t funcId = ValidateTokenOpret(tx, v, reftokenid, voutPubkeys, vopretExtra); + std::vector vcontractOpret; + const uint8_t funcId = ValidateTokenOpret(tx, v, reftokenid, voutPubkeys, vcontractOpret); std::cerr << indentStr << "IsTokensvout() ValidateTokenOpret returned=" << (char)(funcId?funcId:' ') << " for txid=" << tx.GetHash().GetHex() << " for tokenid=" << reftokenid.GetHex() << std::endl; if (funcId != 0) { std::cerr << indentStr << "IsTokensvout() ValidateTokenOpret returned not-null" << " for txid=" << tx.GetHash().GetHex() << " for tokenid=" << reftokenid.GetHex() << std::endl; if (checkPubkeys && funcId != 'c') { // verify that the vout is token's (for 'c' there is no pubkeys!): - CScript contractScript = CScript(vopretExtra); - std::vector vcontractOpret; + //CScript contractScript = CScript(vopretExtra); + //GetOpReturnData(contractScript, vcontractOpret); - GetOpReturnData(contractScript, vcontractOpret); if (vcontractOpret.size() == 0) { std::cerr << "IsTokensvout() empty contract opret" << std::endl; return 0; @@ -421,7 +421,11 @@ int64_t IsTokensvout(bool goDeeper, bool checkPubkeys, struct CCcontract_info *c // compares cc inputs vs cc outputs (to prevent feeding vouts from normal inputs) bool TokensExactAmounts(bool goDeeper, struct CCcontract_info *cpTokens, int64_t &inputs, int64_t &outputs, Eval* eval, const CTransaction &tx, uint256 tokenid) { - CTransaction vinTx; uint256 hashBlock, id, id2; int32_t flag; int64_t tokenoshis; std::vector tmporigpubkey; int64_t tmpprice; + CTransaction vinTx; + uint256 hashBlock; //, id, id2; + //int32_t flag; + int64_t tokenoshis; + // std::vector tmporigpubkey; int64_t tmpprice; std::vector vinPubkeys, vinPubkeysEmpty; int32_t numvins = tx.vin.size(); @@ -449,7 +453,7 @@ bool TokensExactAmounts(bool goDeeper, struct CCcontract_info *cpTokens, int64_t tokenValIndentSize++; // validate vouts of vintx //std::cerr << indentStr << "TokenExactAmounts() check vin i=" << i << " nValue=" << vinTx.vout[tx.vin[i].prevout.n].nValue << std::endl; - tokenoshis = IsTokensvout(goDeeper, true, cpTokens, eval, tmporigpubkey, vinTx, tx.vin[i].prevout.n, tokenid, vinPubkeys); + tokenoshis = IsTokensvout(goDeeper, true, cpTokens, eval, /*tmporigpubkey,*/ vinTx, tx.vin[i].prevout.n, tokenid, vinPubkeys); tokenValIndentSize--; if (tokenoshis != 0) { @@ -464,9 +468,9 @@ bool TokensExactAmounts(bool goDeeper, struct CCcontract_info *cpTokens, int64_t for (int32_t i = 0; i vopretExtra; + //std::vector vopretExtra; CTransaction vintx; int32_t j, vout, n = 0; std::vector > unspentOutputs; @@ -524,7 +528,7 @@ int64_t AddTokenCCInputs(struct CCcontract_info *cp, CMutableTransaction &mtx, C std::vector vinPubkeys; - if ((nValue = IsTokensvout(true, true/*<--add only checked uxtos */, cp, NULL, vopretExtra, vintx, vout, tokenid, vinPubkeys)) > 0 && myIsutxo_spentinmempool(txid, vout) == 0) + if ((nValue = IsTokensvout(true, true/*<--add only checked uxtos */, cp, NULL, /*vopretExtra,*/ vintx, vout, tokenid, vinPubkeys)) > 0 && myIsutxo_spentinmempool(txid, vout) == 0) { if (total != 0 && maxinputs != 0) mtx.vin.push_back(CTxIn(txid, vout, CScript()));