From 7d38d22ce9a67c60fe24ae2dae51b60ecfc954ce Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 12 Jul 2019 01:35:59 -1100 Subject: [PATCH] ->myGetTransaction for nSPV virtualisation --- src/cc/CCassetstx.cpp | 12 ++++---- src/cc/CCtokens.cpp | 8 ++--- src/cc/auction.cpp | 2 +- src/cc/cclib.cpp | 4 +-- src/cc/channels.cpp | 24 +++++++-------- src/cc/dilithium.c | 2 +- src/cc/eval.cpp | 2 +- src/cc/fsm.cpp | 2 +- src/cc/gateways.cpp | 66 ++++++++++++++++++++-------------------- src/cc/heir.cpp | 6 ++-- src/cc/import.cpp | 6 ++-- src/cc/importgateway.cpp | 58 +++++++++++++++++------------------ src/cc/lotto.cpp | 8 ++--- src/cc/marmara.cpp | 18 +++++------ src/cc/oracles.cpp | 26 ++++++++-------- src/cc/payments.cpp | 2 +- src/cc/pegs.cpp | 48 ++++++++++++++--------------- src/cc/prices.cpp | 4 +-- src/cc/rewards.cpp | 12 ++++---- src/cc/sudoku.cpp | 6 ++-- src/rpc/crosschain.cpp | 4 +-- 21 files changed, 160 insertions(+), 160 deletions(-) diff --git a/src/cc/CCassetstx.cpp b/src/cc/CCassetstx.cpp index 0929591ff..6788cbf1f 100644 --- a/src/cc/CCassetstx.cpp +++ b/src/cc/CCassetstx.cpp @@ -39,7 +39,7 @@ UniValue AssetOrders(uint256 refassetid, CPubKey pk, uint8_t additionalEvalCode) txid = it->first.txhash; LOGSTREAM("ccassets", CCLOG_DEBUG2, stream << "addOrders() checking txid=" << txid.GetHex() << std::endl); - if ( GetTransaction(txid, ordertx, hashBlock, false) != 0 ) + if ( myGetTransaction(txid, ordertx, hashBlock) != 0 ) { // for logging: funcid = DecodeAssetOpRet(vintx.vout[vintx.vout.size() - 1].scriptPubKey, evalCode, assetid, assetid2, price, origpubkey); if (ordertx.vout.size() > 0 && (funcid = DecodeAssetTokenOpRet(ordertx.vout[ordertx.vout.size()-1].scriptPubKey, evalCode, assetid, assetid2, price, origpubkey)) != 0) @@ -273,7 +273,7 @@ std::string CreateBuyOffer(int64_t txfee, int64_t bidamount, uint256 assetid, in fprintf(stderr,"negative bidamount %lld, pricetotal %lld\n", (long long)bidamount, (long long)pricetotal); return(""); } - if (GetTransaction(assetid, vintx, hashBlock, false) == 0) + if (myGetTransaction(assetid, vintx, hashBlock) == 0) { fprintf(stderr,"cant find assetid\n"); return(""); @@ -470,7 +470,7 @@ std::string CancelBuyOffer(int64_t txfee,uint256 assetid,uint256 bidtxid) if (AddNormalinputs(mtx, mypk, txfee, 3) > 0) { mask = ~((1LL << mtx.vin.size()) - 1); - if (GetTransaction(bidtxid, vintx, hashBlock, false) != 0) + if (myGetTransaction(bidtxid, vintx, hashBlock) != 0) { std::vector vopretNonfungible; GetNonfungibleData(assetid, vopretNonfungible); @@ -520,7 +520,7 @@ std::string CancelSell(int64_t txfee,uint256 assetid,uint256 asktxid) if (AddNormalinputs(mtx, mypk, txfee, 3) > 0) { mask = ~((1LL << mtx.vin.size()) - 1); - if (GetTransaction(asktxid, vintx, hashBlock, false) != 0) + if (myGetTransaction(asktxid, vintx, hashBlock) != 0) { std::vector vopretNonfungible; GetNonfungibleData(assetid, vopretNonfungible); @@ -594,7 +594,7 @@ std::string FillBuyOffer(int64_t txfee,uint256 assetid,uint256 bidtxid,int64_t f if (AddNormalinputs(mtx, mypk, 2*txfee, 3) > 0) { mask = ~((1LL << mtx.vin.size()) - 1); - if (GetTransaction(bidtxid, vintx, hashBlock, false) != 0) + if (myGetTransaction(bidtxid, vintx, hashBlock) != 0) { bidamount = vintx.vout[bidvout].nValue; SetAssetOrigpubkey(origpubkey, origprice, vintx); @@ -697,7 +697,7 @@ std::string FillSell(int64_t txfee, uint256 assetid, uint256 assetid2, uint256 a //if (AddNormalinputs(mtx, mypk, 2*txfee, 3) > 0) //{ //mask = ~((1LL << mtx.vin.size()) - 1); - if (GetTransaction(asktxid, vintx, hashBlock, false) != 0) + if (myGetTransaction(asktxid, vintx, hashBlock) != 0) { orig_assetoshis = vintx.vout[askvout].nValue; SetAssetOrigpubkey(origpubkey, total_nValue, vintx); diff --git a/src/cc/CCtokens.cpp b/src/cc/CCtokens.cpp index 0319af622..289549c36 100644 --- a/src/cc/CCtokens.cpp +++ b/src/cc/CCtokens.cpp @@ -654,7 +654,7 @@ int64_t AddTokenCCInputs(struct CCcontract_info *cp, CMutableTransaction &mtx, C if (ivin != mtx.vin.size()) // that is, the tx.vout is already added to mtx.vin (in some previous calls) continue; - if (GetTransaction(vintxid, vintx, hashBlock, false) != 0) + if (myGetTransaction(vintxid, vintx, hashBlock) != 0) { Getscriptaddress(destaddr, vintx.vout[vout].scriptPubKey); if (strcmp(destaddr, tokenaddr) != 0 && @@ -920,7 +920,7 @@ int64_t GetTokenBalance(CPubKey pk, uint256 tokenid) // CCerror = strprintf("obsolete, cannot return correct value without eval"); // return 0; - if (GetTransaction(tokenid, tokentx, hashBlock, false) == 0) + if (myGetTransaction(tokenid, tokentx, hashBlock) == 0) { LOGSTREAM((char *)"cctokens", CCLOG_INFO, stream << "cant find tokenid" << std::endl); CCerror = strprintf("cant find tokenid"); @@ -945,7 +945,7 @@ UniValue TokenInfo(uint256 tokenid) cpTokens = CCinit(&tokensCCinfo, EVAL_TOKENS); - if( !GetTransaction(tokenid, tokenbaseTx, hashBlock, false) ) + if( !myGetTransaction(tokenid, tokenbaseTx, hashBlock) ) { fprintf(stderr, "TokenInfo() cant find tokenid\n"); result.push_back(Pair("result", "error")); @@ -1031,7 +1031,7 @@ UniValue TokenList() cp = CCinit(&C, EVAL_TOKENS); auto addTokenId = [&](uint256 txid) { - if (GetTransaction(txid, vintx, hashBlock, false) != 0) { + if (myGetTransaction(txid, vintx, hashBlock) != 0) { if (vintx.vout.size() > 0 && DecodeTokenCreateOpRet(vintx.vout[vintx.vout.size() - 1].scriptPubKey, origpubkey, name, description) != 0) { result.push_back(txid.GetHex()); } diff --git a/src/cc/auction.cpp b/src/cc/auction.cpp index 7521256c7..88d5134af 100644 --- a/src/cc/auction.cpp +++ b/src/cc/auction.cpp @@ -131,7 +131,7 @@ int64_t AddAuctionInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPu // prevent dup if ( it->second.satoshis < 1000000 ) continue; - if ( GetTransaction(txid,vintx,hashBlock,false) != 0 ) + if ( myGetTransaction(txid,vintx,hashBlock) != 0 ) { if ( (nValue= IsAuctionvout(cp,vintx,(int32_t)it->first.index)) > 0 ) { diff --git a/src/cc/cclib.cpp b/src/cc/cclib.cpp index ee52dadcf..dddd59f59 100644 --- a/src/cc/cclib.cpp +++ b/src/cc/cclib.cpp @@ -520,7 +520,7 @@ int64_t AddCClibInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubK if ( it->second.satoshis < threshold || it->second.satoshis == txfee ) continue; // no need to prevent dup - if ( GetTransaction(txid,vintx,hashBlock,false) != 0 ) + if ( myGetTransaction(txid,vintx,hashBlock) != 0 ) { if ( (nValue= IsCClibvout(cp,vintx,vout,cmpaddr)) >= 1000000 && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 ) { @@ -550,7 +550,7 @@ int64_t AddCClibtxfee(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKe //char str[65]; fprintf(stderr,"%s check %s/v%d %.8f vs %.8f\n",coinaddr,uint256_str(str,txid),vout,(double)it->second.satoshis/COIN,(double)threshold/COIN); if ( it->second.satoshis < txfee ) continue; - if ( GetTransaction(txid,vintx,hashBlock,false) != 0 ) + if ( myGetTransaction(txid,vintx,hashBlock) != 0 ) { if ( (nValue= IsCClibvout(cp,vintx,vout,coinaddr)) != 0 && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 ) { diff --git a/src/cc/channels.cpp b/src/cc/channels.cpp index 2d161675c..f88546b6e 100644 --- a/src/cc/channels.cpp +++ b/src/cc/channels.cpp @@ -416,7 +416,7 @@ int64_t AddChannelsInputs(struct CCcontract_info *cp,CMutableTransaction &mtx, C else marker=2; for (std::vector >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++) { - if ( (int32_t)it->first.index==0 && GetTransaction(it->first.txhash,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size()) > 0) + if ( (int32_t)it->first.index==0 && myGetTransaction(it->first.txhash,tx,hashBlock) != 0 && (numvouts=tx.vout.size()) > 0) { if (DecodeChannelsOpRet(tx.vout[numvouts-1].scriptPubKey,tokenid,tmp_txid,srcpub,destpub,param1,param2,param3)!=0 && (tmp_txid==openTx.GetHash() || tx.GetHash()==openTx.GetHash()) && IsChannelsMarkervout(cp,tx,marker==1?srcpub:destpub,marker)>0 && @@ -517,7 +517,7 @@ std::string ChannelPayment(uint64_t txfee,uint256 opentxid,int64_t amount, uint2 if ( txfee == 0 ) txfee = 10000; mypk = pubkey2pk(Mypubkey()); - if (GetTransaction(opentxid,channelOpenTx,hashblock,false) == 0) + if (myGetTransaction(opentxid,channelOpenTx,hashblock) == 0) { CCerror = strprintf("invalid channel open txid"); LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -555,7 +555,7 @@ std::string ChannelPayment(uint64_t txfee,uint256 opentxid,int64_t amount, uint2 if ((funds=AddChannelsInputs(cp,mtx,channelOpenTx,prevtxid,mypk)) !=0 && (change=funds-amount)>=0) { numpayments=amount/payment; - if (GetTransaction(prevtxid,prevTx,hashblock,false) != 0 && (numvouts=prevTx.vout.size()) > 0 && + if (myGetTransaction(prevtxid,prevTx,hashblock) != 0 && (numvouts=prevTx.vout.size()) > 0 && ((funcid = DecodeChannelsOpRet(prevTx.vout[numvouts-1].scriptPubKey, tokenid, txid, srcpub, destpub, prevdepth, param2, param3)) != 0) && (funcid == 'P' || funcid=='O')) { @@ -642,7 +642,7 @@ std::string ChannelClose(uint64_t txfee,uint256 opentxid) if ( txfee == 0 ) txfee = 10000; mypk = pubkey2pk(Mypubkey()); - if (GetTransaction(opentxid,channelOpenTx,hashblock,false) == 0) + if (myGetTransaction(opentxid,channelOpenTx,hashblock) == 0) { CCerror = strprintf("invalid channel open txid"); LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -702,7 +702,7 @@ std::string ChannelRefund(uint64_t txfee,uint256 opentxid,uint256 closetxid) if ( txfee == 0 ) txfee = 10000; mypk = pubkey2pk(Mypubkey()); - if (GetTransaction(closetxid,channelCloseTx,hashblock,false) == 0) + if (myGetTransaction(closetxid,channelCloseTx,hashblock) == 0) { CCerror = strprintf("invalid channel close txid"); LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -726,7 +726,7 @@ std::string ChannelRefund(uint64_t txfee,uint256 opentxid,uint256 closetxid) LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl); return (""); } - if (GetTransaction(opentxid,channelOpenTx,hashblock,false) == 0) + if (myGetTransaction(opentxid,channelOpenTx,hashblock) == 0) { CCerror = strprintf("invalid channel open txid"); LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -754,7 +754,7 @@ std::string ChannelRefund(uint64_t txfee,uint256 opentxid,uint256 closetxid) { if ((funds=AddChannelsInputs(cp,mtx,channelOpenTx,prevtxid,mypk)) !=0 && funds>0) { - if ((GetTransaction(prevtxid,prevTx,hashblock,false) != 0) && (numvouts=prevTx.vout.size()) > 0 && + if ((myGetTransaction(prevtxid,prevTx,hashblock) != 0) && (numvouts=prevTx.vout.size()) > 0 && DecodeChannelsOpRet(prevTx.vout[numvouts-1].scriptPubKey, tokenid, txid, srcpub, destpub, param1, param2, param3) != 0) { mtx.vout.push_back(MakeCC1vout(EVAL_CHANNELS,CC_MARKER_VALUE,mypk)); @@ -799,7 +799,7 @@ UniValue ChannelsList() txid = it->first.txhash; vout = (int32_t)it->first.index; nValue = (int64_t)it->second; - if ( (vout == 1 || vout == 2) && nValue == CC_MARKER_VALUE && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 0 ) + if ( (vout == 1 || vout == 2) && nValue == CC_MARKER_VALUE && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 ) { if (DecodeChannelsOpRet(tx.vout[numvouts-1].scriptPubKey,tokenid,tmp_txid,srcpub,destpub,param1,param2,param3) == 'O') { @@ -822,7 +822,7 @@ UniValue ChannelsInfo(uint256 channeltxid) cp = CCinit(&C,EVAL_CHANNELS); mypk = pubkey2pk(Mypubkey()); - if (GetTransaction(channeltxid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 0 && + if (myGetTransaction(channeltxid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 && (DecodeChannelsOpRet(tx.vout[numvouts-1].scriptPubKey,tokenid,opentxid,srcpub,destpub,param1,param2,param3) == 'O')) { GetCCaddress(cp,CCaddr,mypk); @@ -845,7 +845,7 @@ UniValue ChannelsInfo(uint256 channeltxid) SetCCtxids(addressIndex,CCaddr,true); for (std::vector >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++) { - if (GetTransaction(it->first.txhash,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 0 ) + if (myGetTransaction(it->first.txhash,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 ) if (DecodeChannelsOpRet(tx.vout[numvouts-1].scriptPubKey,tokenid,tmp_txid,srcpub,destpub,param1,param2,param3)!=0 && (tmp_txid==channeltxid || tx.GetHash()==channeltxid)) txids.push_back(it->first.txhash); } @@ -861,7 +861,7 @@ UniValue ChannelsInfo(uint256 channeltxid) for (std::vector::const_iterator it=txids.begin(); it!=txids.end(); it++) { txid=*it; - if (txid!=prevtxid && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 0 ) + if (txid!=prevtxid && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 ) { UniValue obj(UniValue::VOBJ); if (DecodeChannelsOpRet(tx.vout[numvouts-1].scriptPubKey,tokenid,tmp_txid,srcpub,destpub,param1,param2,param3) == 'O' && tx.GetHash()==channeltxid) @@ -870,7 +870,7 @@ UniValue ChannelsInfo(uint256 channeltxid) } else if (DecodeChannelsOpRet(tx.vout[numvouts-1].scriptPubKey,tokenid,opentxid,srcpub,destpub,param1,param2,param3) == 'P' && opentxid==channeltxid) { - if (GetTransaction(opentxid,opentx,hashBlock,false) != 0 && (numvouts=opentx.vout.size()) > 0 && + if (myGetTransaction(opentxid,opentx,hashBlock) != 0 && (numvouts=opentx.vout.size()) > 0 && DecodeChannelsOpRet(opentx.vout[numvouts-1].scriptPubKey,tokenid,tmp_txid,srcpub,destpub,numpayments,payment,hashchain) == 'O') { Getscriptaddress(str,tx.vout[3].scriptPubKey); diff --git a/src/cc/dilithium.c b/src/cc/dilithium.c index 5dfa1deda..4a3813e61 100644 --- a/src/cc/dilithium.c +++ b/src/cc/dilithium.c @@ -3354,7 +3354,7 @@ int64_t dilithium_inputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPu //char str[65]; fprintf(stderr,"%s check %s/v%d %.8f vs %.8f\n",coinaddr,uint256_str(str,txid),vout,(double)it->second.satoshis/COIN,(double)threshold/COIN); if ( it->second.satoshis < threshold || it->second.satoshis == DILITHIUM_TXFEE ) continue; - if ( GetTransaction(txid,vintx,hashBlock,false) != 0 && (numvouts= vintx.vout.size()) > 1 ) + if ( myGetTransaction(txid,vintx,hashBlock) != 0 && (numvouts= vintx.vout.size()) > 1 ) { if ( (nValue= IsCClibvout(cp,vintx,vout,cmpaddr)) > DILITHIUM_TXFEE && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 ) { diff --git a/src/cc/eval.cpp b/src/cc/eval.cpp index c580753cf..86065204a 100644 --- a/src/cc/eval.cpp +++ b/src/cc/eval.cpp @@ -129,7 +129,7 @@ bool Eval::GetTxUnconfirmed(const uint256 &hash, CTransaction &txOut, uint256 &h { return(myGetTransaction(hash, txOut,hashBlock)); /*if (!myGetTransaction(hash, txOut,hashBlock)) { - return(GetTransaction(hash, txOut,hashBlock)); + return(myGetTransaction(hash, txOut,hashBlock)); } else return(true);*/ } diff --git a/src/cc/fsm.cpp b/src/cc/fsm.cpp index e44f85e47..dca2efd2d 100644 --- a/src/cc/fsm.cpp +++ b/src/cc/fsm.cpp @@ -133,7 +133,7 @@ int64_t AddFSMInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey // prevent dup if ( it->second.satoshis < 1000000 ) continue; - if ( GetTransaction(txid,vintx,hashBlock,false) != 0 ) + if ( myGetTransaction(txid,vintx,hashBlock,false) != 0 ) { if ( (nValue= IsFSMvout(cp,vintx,(int32_t)it->first.index)) > 0 ) { diff --git a/src/cc/gateways.cpp b/src/cc/gateways.cpp index 00c80082b..c25a6e001 100644 --- a/src/cc/gateways.cpp +++ b/src/cc/gateways.cpp @@ -823,7 +823,7 @@ int64_t AddGatewaysInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CP std::vector > unspentOutputs; std::string refcoin,tmprefcoin; CPubKey withdrawpub,destpub; uint256 tokenid,txid,oracletxid,tmpbindtxid,tmptokenid,deposittxid,hashBlock; - if ( GetTransaction(bindtxid,bindtx,hashBlock,false) != 0 ) + if ( myGetTransaction(bindtxid,bindtx,hashBlock) != 0 ) { if ((numvouts=bindtx.vout.size())!=0 && DecodeGatewaysBindOpRet(depositaddr,bindtx.vout[numvouts-1].scriptPubKey,tokenid,refcoin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) == 'B') { @@ -839,7 +839,7 @@ int64_t AddGatewaysInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CP { txid = it->first.txhash; vout = (int32_t)it->first.index; - if ( GetTransaction(txid,vintx,hashBlock,false) != 0 ) + if ( myGetTransaction(txid,vintx,hashBlock) != 0 ) { funcid=DecodeGatewaysOpRet(vintx.vout[vintx.vout.size()-1].scriptPubKey); if ((vout==0 && funcid=='B' && bindtxid==txid && total != 0 && maxinputs != 0) || @@ -932,7 +932,7 @@ std::string GatewaysBind(uint64_t txfee,std::string coin,uint256 tokenid,int64_t LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - if ( GetTransaction(oracletxid,oracletx,hashBlock,false) == 0 || (numvouts= oracletx.vout.size()) <= 0 ) + if ( myGetTransaction(oracletxid,oracletx,hashBlock) == 0 || (numvouts= oracletx.vout.size()) <= 0 ) { CCerror = strprintf("cant find oracletxid %s",uint256_str(str,oracletxid)); LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -982,7 +982,7 @@ std::string GatewaysDeposit(uint64_t txfee,uint256 bindtxid,int32_t height,std:: txfee = 10000; mypk = pubkey2pk(Mypubkey()); LOGSTREAM("gatewayscc",CCLOG_DEBUG1, stream << "GatewaysDeposit ht." << height << " " << refcoin << " " << (double)amount/COIN << " numpks." << (int32_t)pubkeys.size() << std::endl); - if ( GetTransaction(bindtxid,bindtx,hashBlock,false) == 0 || (numvouts= bindtx.vout.size()) <= 0 ) + if ( myGetTransaction(bindtxid,bindtx,hashBlock) == 0 || (numvouts= bindtx.vout.size()) <= 0 ) { CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid)); LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -1059,7 +1059,7 @@ std::string GatewaysClaim(uint64_t txfee,uint256 bindtxid,std::string refcoin,ui txfee = 10000; mypk = pubkey2pk(Mypubkey()); gatewayspk = GetUnspendable(cp,0); - if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 ) + if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 ) { CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid)); LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -1077,7 +1077,7 @@ std::string GatewaysClaim(uint64_t txfee,uint256 bindtxid,std::string refcoin,ui LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - if ( GetTransaction(deposittxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 ) + if ( myGetTransaction(deposittxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 ) { CCerror = strprintf("cant find deposittxid %s",uint256_str(str,bindtxid)); LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -1138,7 +1138,7 @@ std::string GatewaysWithdraw(uint64_t txfee,uint256 bindtxid,std::string refcoin mypk = pubkey2pk(Mypubkey()); gatewayspk = GetUnspendable(cp, 0); - if( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 ) + if( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 ) { CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid)); LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -1164,7 +1164,7 @@ std::string GatewaysWithdraw(uint64_t txfee,uint256 bindtxid,std::string refcoin vout = (int32_t)it->first.index; nValue = (int64_t)it->second.satoshis; K=0; - if ( vout == 0 && nValue == 10000 && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size())>0 && + if ( vout == 0 && nValue == 10000 && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size())>0 && (funcid=DecodeGatewaysOpRet(tx.vout[numvouts-1].scriptPubKey))!=0 && (funcid=='W' || funcid=='P')) { if (funcid=='W' && DecodeGatewaysWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmptokenid,tmpbindtxid,coin,withdrawpub,tmpamount)=='W' @@ -1176,7 +1176,7 @@ std::string GatewaysWithdraw(uint64_t txfee,uint256 bindtxid,std::string refcoin } else if (funcid=='P' && DecodeGatewaysPartialOpRet(tx.vout[numvouts-1].scriptPubKey,withdrawtxid,coin,K,signerpk,hex)=='P' && - GetTransaction(withdrawtxid,tx,hashBlock,false)!=0 && (numvouts=tx.vout.size())>0 && DecodeGatewaysWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmptokenid,tmpbindtxid,coin,withdrawpub,tmpamount)=='W' + myGetTransaction(withdrawtxid,tx,hashBlock)!=0 && (numvouts=tx.vout.size())>0 && DecodeGatewaysWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmptokenid,tmpbindtxid,coin,withdrawpub,tmpamount)=='W' && refcoin==coin && tmptokenid==tokenid && tmpbindtxid==bindtxid) { CCerror = strprintf("unable to create withdraw, another withdraw pending"); @@ -1220,7 +1220,7 @@ std::string GatewaysPartialSign(uint64_t txfee,uint256 lasttxid,std::string refc txfee = 10000; mypk = pubkey2pk(Mypubkey()); gatewayspk = GetUnspendable(cp,0); - if (GetTransaction(lasttxid,tx,hashBlock,false)==0 || (numvouts= tx.vout.size())<=0 + if (myGetTransaction(lasttxid,tx,hashBlock)==0 || (numvouts= tx.vout.size())<=0 || (funcid=DecodeGatewaysOpRet(tx.vout[numvouts-1].scriptPubKey))==0 || (funcid!='W' && funcid!='P')) { CCerror = strprintf("can't find last tx %s",uint256_str(str,lasttxid)); @@ -1242,7 +1242,7 @@ std::string GatewaysPartialSign(uint64_t txfee,uint256 lasttxid,std::string refc LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - else if (GetTransaction(bindtxid,tmptx,hashBlock,false)==0 || (numvouts=tmptx.vout.size())<=0) + else if (myGetTransaction(bindtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())<=0) { CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid)); LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -1264,7 +1264,7 @@ std::string GatewaysPartialSign(uint64_t txfee,uint256 lasttxid,std::string refc LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - else if (GetTransaction(withdrawtxid,tmptx,hashBlock,false)==0 || (numvouts= tmptx.vout.size())<=0) + else if (myGetTransaction(withdrawtxid,tmptx,hashBlock)==0 || (numvouts= tmptx.vout.size())<=0) { CCerror = strprintf("can't find withdraw tx %s",uint256_str(str,withdrawtxid)); LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -1283,7 +1283,7 @@ std::string GatewaysPartialSign(uint64_t txfee,uint256 lasttxid,std::string refc LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - else if (GetTransaction(bindtxid,tmptx,hashBlock,false)==0 || (numvouts=tmptx.vout.size())<=0) + else if (myGetTransaction(bindtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())<=0) { CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid)); LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -1320,7 +1320,7 @@ std::string GatewaysCompleteSigning(uint64_t txfee,uint256 lasttxid,std::string gatewayspk = GetUnspendable(cp,0); if ( txfee == 0 ) txfee = 10000; - if (GetTransaction(lasttxid,tx,hashBlock,false)==0 || (numvouts= tx.vout.size())<=0 + if (myGetTransaction(lasttxid,tx,hashBlock)==0 || (numvouts= tx.vout.size())<=0 || (funcid=DecodeGatewaysOpRet(tx.vout[numvouts-1].scriptPubKey))==0 || (funcid!='W' && funcid!='P')) { CCerror = strprintf("invalid last txid %s",uint256_str(str,lasttxid)); @@ -1336,7 +1336,7 @@ std::string GatewaysCompleteSigning(uint64_t txfee,uint256 lasttxid,std::string LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - else if (GetTransaction(bindtxid,tmptx,hashBlock,false)==0 || (numvouts=tmptx.vout.size())<=0) + else if (myGetTransaction(bindtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())<=0) { CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid)); LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -1364,7 +1364,7 @@ std::string GatewaysCompleteSigning(uint64_t txfee,uint256 lasttxid,std::string LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - else if (GetTransaction(withdrawtxid,tmptx,hashBlock,false)==0 || (numvouts=tmptx.vout.size())==0) + else if (myGetTransaction(withdrawtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())==0) { CCerror = strprintf("invalid withdraw txid %s",uint256_str(str,withdrawtxid)); LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -1382,7 +1382,7 @@ std::string GatewaysCompleteSigning(uint64_t txfee,uint256 lasttxid,std::string LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - else if (GetTransaction(bindtxid,tmptx,hashBlock,false)==0 || (numvouts=tmptx.vout.size())<=0) + else if (myGetTransaction(bindtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())<=0) { CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid)); LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -1418,7 +1418,7 @@ std::string GatewaysMarkDone(uint64_t txfee,uint256 completetxid,std::string ref mypk = pubkey2pk(Mypubkey()); if ( txfee == 0 ) txfee = 10000; - if (GetTransaction(completetxid,tx,hashBlock,false)==0 || (numvouts= tx.vout.size())<=0) + if (myGetTransaction(completetxid,tx,hashBlock)==0 || (numvouts= tx.vout.size())<=0) { CCerror = strprintf("invalid completesigning txid %s",uint256_str(str,completetxid)); LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -1436,7 +1436,7 @@ std::string GatewaysMarkDone(uint64_t txfee,uint256 completetxid,std::string ref LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - else if (GetTransaction(withdrawtxid,tx,hashBlock,false)==0 || (numvouts= tx.vout.size())==0) + else if (myGetTransaction(withdrawtxid,tx,hashBlock)==0 || (numvouts= tx.vout.size())==0) { CCerror = strprintf("invalid withdraw txid %s",uint256_str(str,withdrawtxid)); LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -1448,7 +1448,7 @@ std::string GatewaysMarkDone(uint64_t txfee,uint256 completetxid,std::string ref LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - else if (GetTransaction(bindtxid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0) + else if (myGetTransaction(bindtxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0) { CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid)); LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -1485,7 +1485,7 @@ UniValue GatewaysPendingDeposits(uint256 bindtxid,std::string refcoin) mypk = pubkey2pk(Mypubkey()); gatewayspk = GetUnspendable(cp,0); _GetCCaddress(coinaddr,EVAL_GATEWAYS,mypk); - if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 ) + if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 ) { result.push_back(Pair("result","error")); result.push_back(Pair("error",strprintf("cant find bindtxid %s",uint256_str(str,bindtxid)))); @@ -1503,7 +1503,7 @@ UniValue GatewaysPendingDeposits(uint256 bindtxid,std::string refcoin) txid = it->first.txhash; vout = (int32_t)it->first.index; nValue = (int64_t)it->second.satoshis; - if ( vout == 0 && nValue == 10000 && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size())>0 && + if ( vout == 0 && nValue == 10000 && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 && DecodeGatewaysDepositOpRet(tx.vout[numvouts-1].scriptPubKey,tmpbindtxid,coin,publishers,txids,height,cointxid,claimvout,hex,proof,destpub,amount) == 'D' && tmpbindtxid==bindtxid && refcoin == coin && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0) { @@ -1540,7 +1540,7 @@ UniValue GatewaysPendingWithdraws(uint256 bindtxid,std::string refcoin) gatewayspk = GetUnspendable(cp,0); _GetCCaddress(coinaddr,EVAL_GATEWAYS,gatewayspk); GetTokensCCaddress(cp,tokensaddr,gatewayspk); - if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 ) + if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 ) { result.push_back(Pair("result","error")); result.push_back(Pair("error",strprintf("cant find bindtxid %s",uint256_str(str,bindtxid)))); @@ -1567,7 +1567,7 @@ UniValue GatewaysPendingWithdraws(uint256 bindtxid,std::string refcoin) vout = (int32_t)it->first.index; nValue = (int64_t)it->second.satoshis; K=0; - if ( vout == 0 && nValue == 10000 && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size())>0 && + if ( vout == 0 && nValue == 10000 && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size())>0 && (funcid=DecodeGatewaysOpRet(tx.vout[numvouts-1].scriptPubKey))!=0 && (funcid=='W' || funcid=='P') && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0) { if (funcid=='W') @@ -1576,7 +1576,7 @@ UniValue GatewaysPendingWithdraws(uint256 bindtxid,std::string refcoin) } else if (funcid=='P') { - if (DecodeGatewaysPartialOpRet(tx.vout[numvouts-1].scriptPubKey,withdrawtxid,coin,K,signerpk,hex)!='P' || GetTransaction(withdrawtxid,tx,hashBlock,false)==0 + if (DecodeGatewaysPartialOpRet(tx.vout[numvouts-1].scriptPubKey,withdrawtxid,coin,K,signerpk,hex)!='P' || myGetTransaction(withdrawtxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0 || DecodeGatewaysWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmptokenid,tmpbindtxid,coin,withdrawpub,amount)!='W' || refcoin!=coin || tmptokenid!=tokenid || tmpbindtxid!=bindtxid) continue; @@ -1628,7 +1628,7 @@ UniValue GatewaysProcessedWithdraws(uint256 bindtxid,std::string refcoin) mypk = pubkey2pk(Mypubkey()); gatewayspk = GetUnspendable(cp,0); _GetCCaddress(coinaddr,EVAL_GATEWAYS,gatewayspk); - if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 ) + if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 ) { result.push_back(Pair("result","error")); result.push_back(Pair("error",strprintf("cant find bindtxid %s",uint256_str(str,bindtxid)))); @@ -1654,10 +1654,10 @@ UniValue GatewaysProcessedWithdraws(uint256 bindtxid,std::string refcoin) txid = it->first.txhash; vout = (int32_t)it->first.index; nValue = (int64_t)it->second.satoshis; - if ( vout == 0 && nValue == 10000 && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size())>0 && + if ( vout == 0 && nValue == 10000 && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size())>0 && DecodeGatewaysCompleteSigningOpRet(tx.vout[numvouts-1].scriptPubKey,withdrawtxid,coin,K,hex) == 'S' && refcoin == coin && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0) { - if (GetTransaction(withdrawtxid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size())>0 + if (myGetTransaction(withdrawtxid,tx,hashBlock) != 0 && (numvouts= tx.vout.size())>0 && DecodeGatewaysWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmptokenid,bindtxid,coin,withdrawpub,amount) == 'W' || refcoin!=coin || tmptokenid!=tokenid) { UniValue obj(UniValue::VOBJ); @@ -1689,7 +1689,7 @@ UniValue GatewaysList() for (std::vector >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++) { txid = it->first.txhash; - if ( GetTransaction(txid,vintx,hashBlock,false) != 0 ) + if ( myGetTransaction(txid,vintx,hashBlock) != 0 ) { if ( vintx.vout.size() > 0 && DecodeGatewaysBindOpRet(depositaddr,vintx.vout[vintx.vout.size()-1].scriptPubKey,tokenid,coin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) != 0 ) { @@ -1706,7 +1706,7 @@ UniValue GatewaysExternalAddress(uint256 bindtxid,CPubKey pubkey) std::string coin; int64_t numvouts,totalsupply; char str[65],addr[65],depositaddr[65]; uint8_t M,N,taddr,prefix,prefix2,wiftype; std::vector msigpubkeys; cp = CCinit(&C,EVAL_GATEWAYS); - if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 ) + if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 ) { result.push_back(Pair("result","error")); result.push_back(Pair("error",strprintf("cant find bindtxid %s",uint256_str(str,bindtxid)))); @@ -1730,7 +1730,7 @@ UniValue GatewaysDumpPrivKey(uint256 bindtxid,CKey key) std::string coin,priv; int64_t numvouts,totalsupply; char str[65],addr[65],depositaddr[65]; uint8_t M,N,taddr,prefix,prefix2,wiftype; std::vector msigpubkeys; cp = CCinit(&C,EVAL_GATEWAYS); - if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 ) + if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 ) { result.push_back(Pair("result","error")); result.push_back(Pair("error",strprintf("cant find bindtxid %s",uint256_str(str,bindtxid)))); @@ -1759,7 +1759,7 @@ UniValue GatewaysInfo(uint256 bindtxid) cp = CCinit(&C,EVAL_GATEWAYS); Gatewayspk = GetUnspendable(cp,0); GetTokensCCaddress(cp,gatewaystokens,Gatewayspk); - if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 ) + if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 ) { result.push_back(Pair("result","error")); result.push_back(Pair("error",strprintf("cant find bindtxid %s",uint256_str(str,bindtxid)))); @@ -1771,7 +1771,7 @@ UniValue GatewaysInfo(uint256 bindtxid) result.push_back(Pair("error",strprintf("invalid bindtxid %s coin.%s",uint256_str(str,bindtxid),coin.c_str()))); return(result); } - if ( GetTransaction(bindtxid,tx,hashBlock,false) != 0 ) + if ( myGetTransaction(bindtxid,tx,hashBlock) != 0 ) { result.push_back(Pair("result","success")); result.push_back(Pair("name","Gateways")); diff --git a/src/cc/heir.cpp b/src/cc/heir.cpp index e047d1ab1..fc3a2f2fd 100644 --- a/src/cc/heir.cpp +++ b/src/cc/heir.cpp @@ -531,7 +531,7 @@ template int64_t Add1of2AddressInputs(struct CCcontract_info* cp, //std::cerr << "Add1of2AddressInputs() txid=" << txid.GetHex() << std::endl; - if (GetTransaction(txid, heirtx, hashBlock, false) != 0) { + if (myGetTransaction(txid, heirtx, hashBlock) != 0) { uint256 tokenid; uint256 fundingTxidInOpret; uint8_t hasHeirSpendingBegunDummy; @@ -579,7 +579,7 @@ template int64_t LifetimeHeirContractFunds(struct CCcontract_info CTransaction heirtx; // TODO: check all funding tx should contain unspendable markers - if (GetTransaction(txid, heirtx, hashBlock, false) && heirtx.vout.size() > 0) { + if (myGetTransaction(txid, heirtx, hashBlock) && heirtx.vout.size() > 0) { uint256 tokenid; uint256 fundingTxidInOpret; uint8_t hasHeirSpendingBegunDummy; @@ -1232,7 +1232,7 @@ void _HeirList(struct CCcontract_info *cp, UniValue &result) //std::cerr << "HeirList() checking txid=" << txid.GetHex() << " vout=" << vout << '\n'; CTransaction fundingtx; - if (GetTransaction(txid, fundingtx, hashBlock, false)) { + if (myGetTransaction(txid, fundingtx, hashBlock)) { CPubKey ownerPubkey, heirPubkey; std::string heirName, memo; int64_t inactivityTimeSec; diff --git a/src/cc/import.cpp b/src/cc/import.cpp index aa2ea5d11..4a1978e8d 100644 --- a/src/cc/import.cpp +++ b/src/cc/import.cpp @@ -367,7 +367,7 @@ int32_t CheckGATEWAYimport(CTransaction importTx,CTransaction burnTx,std::string return(-1); } // check for valid burn from external coin blockchain and if valid return(0); - if (GetTransaction(bindtxid, bindtx, hashBlock, false) == 0 || (numvouts = bindtx.vout.size()) <= 0) + if (myGetTransaction(bindtxid, bindtx, hashBlock) == 0 || (numvouts = bindtx.vout.size()) <= 0) { LOGSTREAM("importgateway", CCLOG_INFO, stream << "CheckGATEWAYimport cant find bindtxid=" << bindtxid.GetHex() << std::endl); return(-1); @@ -397,7 +397,7 @@ int32_t CheckGATEWAYimport(CTransaction importTx,CTransaction burnTx,std::string LOGSTREAM("importgateway", CCLOG_INFO, stream << "CheckGATEWAYimport bindtx not yet confirmed/notarized" << std::endl); return(-1); } - else if (GetTransaction(oracletxid, oracletx, hashBlock, false) == 0 || (numvouts = oracletx.vout.size()) <= 0) + else if (myGetTransaction(oracletxid, oracletx, hashBlock) == 0 || (numvouts = oracletx.vout.size()) <= 0) { LOGSTREAM("importgateway", CCLOG_INFO, stream << "CheckGATEWAYimport cant find oracletxid=" << oracletxid.GetHex() << std::endl); return(-1); @@ -417,7 +417,7 @@ int32_t CheckGATEWAYimport(CTransaction importTx,CTransaction burnTx,std::string for (std::vector >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++) { txid = it->first.txhash; - if ( GetTransaction(txid,regtx,hashBlock,false) != 0 && regtx.vout.size() > 0 + if ( myGetTransaction(txid,regtx,hashBlock) != 0 && regtx.vout.size() > 0 && DecodeOraclesOpRet(regtx.vout[regtx.vout.size()-1].scriptPubKey,tmporacletxid,regpk,datafee) == 'R' && oracletxid == tmporacletxid ) { pubkeys.push_back(regpk); diff --git a/src/cc/importgateway.cpp b/src/cc/importgateway.cpp index eff7bc287..e5590bb3d 100644 --- a/src/cc/importgateway.cpp +++ b/src/cc/importgateway.cpp @@ -525,7 +525,7 @@ std::string ImportGatewayBind(uint64_t txfee,std::string coin,uint256 oracletxid LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - if ( GetTransaction(oracletxid,oracletx,hashBlock,false) == 0 || (numvouts= oracletx.vout.size()) <= 0 ) + if ( myGetTransaction(oracletxid,oracletx,hashBlock) == 0 || (numvouts= oracletx.vout.size()) <= 0 ) { CCerror = strprintf("cant find oracletxid %s",uint256_str(str,oracletxid)); LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); @@ -581,7 +581,7 @@ std::string ImportGatewayDeposit(uint64_t txfee,uint256 bindtxid,int32_t height, return std::string(""); } LOGSTREAM("importgateway",CCLOG_DEBUG1, stream << "ImportGatewayDeposit ht." << height << " " << refcoin << " " << (double)amount/COIN << " numpks." << (int32_t)pubkeys.size() << std::endl); - if ( GetTransaction(bindtxid,bindtx,hashBlock,false) == 0 || (numvouts= bindtx.vout.size()) <= 0 ) + if ( myGetTransaction(bindtxid,bindtx,hashBlock) == 0 || (numvouts= bindtx.vout.size()) <= 0 ) { CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid)); LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); @@ -651,7 +651,7 @@ std::string ImportGatewayWithdraw(uint64_t txfee,uint256 bindtxid,std::string re mypk = pubkey2pk(Mypubkey()); importgatewaypk = GetUnspendable(cp, 0); - if( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 ) + if( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 ) { CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid)); LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); @@ -677,7 +677,7 @@ std::string ImportGatewayWithdraw(uint64_t txfee,uint256 bindtxid,std::string re vout = (int32_t)it->first.index; nValue = (int64_t)it->second.satoshis; K=0; - if ( vout == 0 && nValue == 10000 && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size())>0 && + if ( vout == 0 && nValue == 10000 && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size())>0 && (funcid=DecodeImportGatewayOpRet(tx.vout[numvouts-1].scriptPubKey))!=0 && (funcid=='W' || funcid=='P')) { if (funcid=='W' && DecodeImportGatewayWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmpbindtxid,coin,withdrawpub,tmpamount)=='W' @@ -689,7 +689,7 @@ std::string ImportGatewayWithdraw(uint64_t txfee,uint256 bindtxid,std::string re } else if (funcid=='P' && DecodeImportGatewayPartialOpRet(tx.vout[numvouts-1].scriptPubKey,withdrawtxid,coin,K,signerpk,hex)=='P' && - GetTransaction(withdrawtxid,tx,hashBlock,false)!=0 && (numvouts=tx.vout.size())>0 && DecodeImportGatewayWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmpbindtxid,coin,withdrawpub,tmpamount)=='W' + myGetTransaction(withdrawtxid,tx,hashBlock)!=0 && (numvouts=tx.vout.size())>0 && DecodeImportGatewayWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmpbindtxid,coin,withdrawpub,tmpamount)=='W' && refcoin==coin && tmpbindtxid==bindtxid) { CCerror = strprintf("unable to create withdraw, another withdraw pending"); @@ -722,7 +722,7 @@ std::string ImportGatewayPartialSign(uint64_t txfee,uint256 lasttxid,std::string txfee = 10000; mypk = pubkey2pk(Mypubkey()); importgatewaypk = GetUnspendable(cp,0); - if (GetTransaction(lasttxid,tx,hashBlock,false)==0 || (numvouts= tx.vout.size())<=0 + if (myGetTransaction(lasttxid,tx,hashBlock)==0 || (numvouts= tx.vout.size())<=0 || (funcid=DecodeImportGatewayOpRet(tx.vout[numvouts-1].scriptPubKey))==0 || (funcid!='W' && funcid!='P')) { CCerror = strprintf("can't find last tx %s",uint256_str(str,lasttxid)); @@ -744,7 +744,7 @@ std::string ImportGatewayPartialSign(uint64_t txfee,uint256 lasttxid,std::string LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - else if (GetTransaction(bindtxid,tmptx,hashBlock,false)==0 || (numvouts=tmptx.vout.size())<=0) + else if (myGetTransaction(bindtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())<=0) { CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid)); LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); @@ -766,7 +766,7 @@ std::string ImportGatewayPartialSign(uint64_t txfee,uint256 lasttxid,std::string LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - else if (GetTransaction(withdrawtxid,tmptx,hashBlock,false)==0 || (numvouts= tmptx.vout.size())<=0) + else if (myGetTransaction(withdrawtxid,tmptx,hashBlock)==0 || (numvouts= tmptx.vout.size())<=0) { CCerror = strprintf("can't find withdraw tx %s",uint256_str(str,withdrawtxid)); LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); @@ -785,7 +785,7 @@ std::string ImportGatewayPartialSign(uint64_t txfee,uint256 lasttxid,std::string LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - else if (GetTransaction(bindtxid,tmptx,hashBlock,false)==0 || (numvouts=tmptx.vout.size())<=0) + else if (myGetTransaction(bindtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())<=0) { CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid)); LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); @@ -822,7 +822,7 @@ std::string ImportGatewayCompleteSigning(uint64_t txfee,uint256 lasttxid,std::st importgatewaypk = GetUnspendable(cp,0); if ( txfee == 0 ) txfee = 10000; - if (GetTransaction(lasttxid,tx,hashBlock,false)==0 || (numvouts= tx.vout.size())<=0 + if (myGetTransaction(lasttxid,tx,hashBlock)==0 || (numvouts= tx.vout.size())<=0 || (funcid=DecodeImportGatewayOpRet(tx.vout[numvouts-1].scriptPubKey))==0 || (funcid!='W' && funcid!='P')) { CCerror = strprintf("invalid last txid %s",uint256_str(str,lasttxid)); @@ -838,7 +838,7 @@ std::string ImportGatewayCompleteSigning(uint64_t txfee,uint256 lasttxid,std::st LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - else if (GetTransaction(bindtxid,tmptx,hashBlock,false)==0 || (numvouts=tmptx.vout.size())<=0) + else if (myGetTransaction(bindtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())<=0) { CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid)); LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); @@ -866,7 +866,7 @@ std::string ImportGatewayCompleteSigning(uint64_t txfee,uint256 lasttxid,std::st LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - else if (GetTransaction(withdrawtxid,tmptx,hashBlock,false)==0 || (numvouts=tmptx.vout.size())==0) + else if (myGetTransaction(withdrawtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())==0) { CCerror = strprintf("invalid withdraw txid %s",uint256_str(str,withdrawtxid)); LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); @@ -884,7 +884,7 @@ std::string ImportGatewayCompleteSigning(uint64_t txfee,uint256 lasttxid,std::st LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - else if (GetTransaction(bindtxid,tmptx,hashBlock,false)==0 || (numvouts=tmptx.vout.size())<=0) + else if (myGetTransaction(bindtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())<=0) { CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid)); LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); @@ -920,7 +920,7 @@ std::string ImportGatewayMarkDone(uint64_t txfee,uint256 completetxid,std::strin mypk = pubkey2pk(Mypubkey()); if ( txfee == 0 ) txfee = 10000; - if (GetTransaction(completetxid,tx,hashBlock,false)==0 || (numvouts= tx.vout.size())<=0) + if (myGetTransaction(completetxid,tx,hashBlock)==0 || (numvouts= tx.vout.size())<=0) { CCerror = strprintf("invalid completesigning txid %s",uint256_str(str,completetxid)); LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); @@ -938,7 +938,7 @@ std::string ImportGatewayMarkDone(uint64_t txfee,uint256 completetxid,std::strin LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - else if (GetTransaction(withdrawtxid,tx,hashBlock,false)==0 || (numvouts= tx.vout.size())==0) + else if (myGetTransaction(withdrawtxid,tx,hashBlock)==0 || (numvouts= tx.vout.size())==0) { CCerror = strprintf("invalid withdraw txid %s",uint256_str(str,withdrawtxid)); LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); @@ -950,7 +950,7 @@ std::string ImportGatewayMarkDone(uint64_t txfee,uint256 completetxid,std::strin LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - else if (GetTransaction(bindtxid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0) + else if (myGetTransaction(bindtxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0) { CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid)); LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); @@ -987,7 +987,7 @@ UniValue ImportGatewayPendingDeposits(uint256 bindtxid,std::string refcoin) mypk = pubkey2pk(Mypubkey()); importgatewaypk = GetUnspendable(cp,0); _GetCCaddress(coinaddr,EVAL_IMPORTGATEWAY,mypk); - if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 ) + if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 ) { CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid)); LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); @@ -1005,7 +1005,7 @@ UniValue ImportGatewayPendingDeposits(uint256 bindtxid,std::string refcoin) txid = it->first.txhash; vout = (int32_t)it->first.index; nValue = (int64_t)it->second.satoshis; - if ( vout == 0 && nValue == 10000 && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size())>0 && + if ( vout == 0 && nValue == 10000 && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 && DecodeImportGatewayDepositOpRet(tx.vout[numvouts-1].scriptPubKey,tmpbindtxid,coin,publishers,txids,height,burntxid,claimvout,hex,proof,destpub,amount) == 'D' && tmpbindtxid==bindtxid && refcoin == coin && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0) { @@ -1041,7 +1041,7 @@ UniValue ImportGatewayPendingWithdraws(uint256 bindtxid,std::string refcoin) mypk = pubkey2pk(Mypubkey()); importgatewaypk = GetUnspendable(cp,0); _GetCCaddress(coinaddr,EVAL_IMPORTGATEWAY,importgatewaypk); - if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 ) + if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 ) { CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid)); LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); @@ -1068,7 +1068,7 @@ UniValue ImportGatewayPendingWithdraws(uint256 bindtxid,std::string refcoin) vout = (int32_t)it->first.index; nValue = (int64_t)it->second.satoshis; K=0; - if ( vout == 0 && nValue == 10000 && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size())>0 && + if ( vout == 0 && nValue == 10000 && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size())>0 && (funcid=DecodeImportGatewayOpRet(tx.vout[numvouts-1].scriptPubKey))!=0 && (funcid=='W' || funcid=='P') && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0) { if (funcid=='W') @@ -1077,7 +1077,7 @@ UniValue ImportGatewayPendingWithdraws(uint256 bindtxid,std::string refcoin) } else if (funcid=='P') { - if (DecodeImportGatewayPartialOpRet(tx.vout[numvouts-1].scriptPubKey,withdrawtxid,coin,K,signerpk,hex)!='P' || GetTransaction(withdrawtxid,tx,hashBlock,false)==0 + if (DecodeImportGatewayPartialOpRet(tx.vout[numvouts-1].scriptPubKey,withdrawtxid,coin,K,signerpk,hex)!='P' || myGetTransaction(withdrawtxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0 || DecodeImportGatewayWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmpbindtxid,coin,withdrawpub,amount)!='W' || refcoin!=coin || tmpbindtxid!=bindtxid) continue; @@ -1129,7 +1129,7 @@ UniValue ImportGatewayProcessedWithdraws(uint256 bindtxid,std::string refcoin) mypk = pubkey2pk(Mypubkey()); importgatewaypk = GetUnspendable(cp,0); _GetCCaddress(coinaddr,EVAL_IMPORTGATEWAY,importgatewaypk); - if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 ) + if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 ) { CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid)); LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); @@ -1155,10 +1155,10 @@ UniValue ImportGatewayProcessedWithdraws(uint256 bindtxid,std::string refcoin) txid = it->first.txhash; vout = (int32_t)it->first.index; nValue = (int64_t)it->second.satoshis; - if ( vout == 0 && nValue == 10000 && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size())>0 && + if ( vout == 0 && nValue == 10000 && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size())>0 && DecodeImportGatewayCompleteSigningOpRet(tx.vout[numvouts-1].scriptPubKey,withdrawtxid,coin,K,hex) == 'S' && refcoin == coin && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0) { - if (GetTransaction(withdrawtxid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size())>0 + if (myGetTransaction(withdrawtxid,tx,hashBlock) != 0 && (numvouts= tx.vout.size())>0 && DecodeImportGatewayWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,bindtxid,coin,withdrawpub,amount) == 'W' || refcoin!=coin) { UniValue obj(UniValue::VOBJ); @@ -1192,7 +1192,7 @@ UniValue ImportGatewayList() for (std::vector >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++) { txid = it->first.txhash; - if ( GetTransaction(txid,vintx,hashBlock,false) != 0 ) + if ( myGetTransaction(txid,vintx,hashBlock) != 0 ) { if ( vintx.vout.size() > 0 && DecodeImportGatewayBindOpRet(burnaddr,vintx.vout[vintx.vout.size()-1].scriptPubKey,coin,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) != 0 ) { @@ -1209,7 +1209,7 @@ UniValue ImportGatewayExternalAddress(uint256 bindtxid,CPubKey pubkey) std::string coin; int64_t numvouts; char str[65],addr[65],burnaddr[65]; uint8_t M,N,taddr,prefix,prefix2,wiftype; std::vector msigpubkeys; cp = CCinit(&C,EVAL_IMPORTGATEWAY); - if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 ) + if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 ) { CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid)); LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); @@ -1233,7 +1233,7 @@ UniValue ImportGatewayDumpPrivKey(uint256 bindtxid,CKey key) std::string coin,priv; int64_t numvouts; char str[65],addr[65],burnaddr[65]; uint8_t M,N,taddr,prefix,prefix2,wiftype; std::vector msigpubkeys; cp = CCinit(&C,EVAL_IMPORTGATEWAY); - if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 ) + if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 ) { CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid)); LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); @@ -1262,7 +1262,7 @@ UniValue ImportGatewayInfo(uint256 bindtxid) cp = CCinit(&C,EVAL_IMPORTGATEWAY); ImportGatewaypk = GetUnspendable(cp,0); GetTokensCCaddress(cp,gatewaystokens,ImportGatewaypk); - if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 ) + if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 ) { CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid)); LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); @@ -1274,7 +1274,7 @@ UniValue ImportGatewayInfo(uint256 bindtxid) LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - if ( GetTransaction(bindtxid,tx,hashBlock,false) != 0 ) + if ( myGetTransaction(bindtxid,tx,hashBlock) != 0 ) { result.push_back(Pair("result","success")); result.push_back(Pair("name","ImportGateway")); diff --git a/src/cc/lotto.cpp b/src/cc/lotto.cpp index f873b3881..e8466bd88 100644 --- a/src/cc/lotto.cpp +++ b/src/cc/lotto.cpp @@ -173,7 +173,7 @@ int64_t AddLottoInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubK // prevent dup if ( it->second.satoshis < COIN ) continue; - if ( GetTransaction(txid,vintx,hashBlock,false) != 0 ) + if ( myGetTransaction(txid,vintx,hashBlock) != 0 ) { if ( (nValue= IsLottovout(cp,vintx,(int32_t)it->first.index)) > 0 ) { @@ -214,7 +214,7 @@ int64_t LottoPlanFunds(uint64_t refsbits,struct CCcontract_info *cp,CPubKey pk,u { txid = it->first.txhash; vout = (int32_t)it->first.index; - if ( GetTransaction(txid,tx,hashBlock,false) != 0 && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 ) + if ( myGetTransaction(txid,tx,hashBlock) != 0 && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 ) { // need to implement this! if ( (funcid= DecodeLottoOpRet(txid,tx.vout[tx.vout.size()-1].scriptPubKey,sbits,fundingtxid)) == 'F' || funcid == 'T' ) { @@ -233,7 +233,7 @@ int64_t LottoPlanFunds(uint64_t refsbits,struct CCcontract_info *cp,CPubKey pk,u UniValue LottoInfo(uint256 lottoid) { UniValue result(UniValue::VOBJ); uint256 hashBlock,hentropy; CTransaction vintx; uint64_t lockedfunds,sbits; int32_t ticketsize,odds,firstheight,period; CPubKey lottopk; struct CCcontract_info *cp,C; char str[67],numstr[65]; - if ( GetTransaction(lottoid,vintx,hashBlock,false) == 0 ) + if ( myGetTransaction(lottoid,vintx,hashBlock) == 0 ) { fprintf(stderr,"cant find lottoid\n"); result.push_back(Pair("result","error")); @@ -270,7 +270,7 @@ UniValue LottoList() for (std::vector >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++) { txid = it->first.txhash; - if ( GetTransaction(txid,vintx,hashBlock,false) != 0 ) + if ( myGetTransaction(txid,vintx,hashBlock) != 0 ) { if ( vintx.vout.size() > 0 && DecodeLottoFundingOpRet(vintx.vout[vintx.vout.size()-1].scriptPubKey,sbits,ticketsize,odds,firstheight,period,hentropy) == 'F' ) { diff --git a/src/cc/marmara.cpp b/src/cc/marmara.cpp index f0d55eaf4..e28566079 100644 --- a/src/cc/marmara.cpp +++ b/src/cc/marmara.cpp @@ -360,7 +360,7 @@ int64_t AddMarmaraCoinbases(struct CCcontract_info *cp,CMutableTransaction &mtx, txid = it->first.txhash; vout = (int32_t)it->first.index; //fprintf(stderr,"txid.%s/v%d\n",txid.GetHex().c_str(),vout); - if ( GetTransaction(txid,vintx,hashBlock,false) != 0 ) + if ( myGetTransaction(txid,vintx,hashBlock) != 0 ) { if ( vintx.IsCoinBase() != 0 && vintx.vout.size() == 2 && vintx.vout[1].nValue == 0 ) { @@ -399,7 +399,7 @@ int64_t AddMarmarainputs(CMutableTransaction &mtx,std::vector &pubkeys, vout = (int32_t)it->first.index; if ( it->second.satoshis < threshold ) continue; - if ( GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 0 && vout < numvouts && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 ) + if ( myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 && vout < numvouts && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 ) { if ( (funcid= DecodeMaramaraCoinbaseOpRet(tx.vout[numvouts-1].scriptPubKey,pk,ht,unlockht)) == 'C' || funcid == 'P' || funcid == 'L' ) { @@ -468,7 +468,7 @@ UniValue MarmaraLock(uint64_t txfee,int64_t amount,int32_t height) vout = (int32_t)it->first.index; if ( (nValue= it->second.satoshis) < threshold ) continue; - if ( GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 0 && vout < numvouts && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 ) + if ( myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 && vout < numvouts && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 ) { if ( (funcid= DecodeMaramaraCoinbaseOpRet(tx.vout[numvouts-1].scriptPubKey,pk,ht,unlockht)) == 'C' || funcid == 'P' || funcid == 'L' ) { @@ -516,7 +516,7 @@ int32_t MarmaraSignature(uint8_t *utxosig,CMutableTransaction &mtx) uint256 txid,hashBlock; uint8_t *ptr; int32_t i,siglen,vout,numvouts; CTransaction tx; std::string rawtx; CPubKey mypk; std::vector pubkeys; struct CCcontract_info *cp,C; uint64_t txfee; txfee = 10000; vout = mtx.vin[0].prevout.n; - if ( GetTransaction(mtx.vin[0].prevout.hash,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 1 && vout < numvouts ) + if ( myGetTransaction(mtx.vin[0].prevout.hash,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 1 && vout < numvouts ) { cp = CCinit(&C,EVAL_MARMARA); mypk = pubkey2pk(Mypubkey()); @@ -553,7 +553,7 @@ UniValue MarmaraSettlement(uint64_t txfee,uint256 refbatontxid) height = chainActive.LastTip()->GetHeight(); if ( (n= MarmaraGetbatontxid(creditloop,batontxid,refbatontxid)) > 0 ) { - if ( GetTransaction(batontxid,batontx,hashBlock,false) != 0 && (numvouts= batontx.vout.size()) > 1 ) + if ( myGetTransaction(batontxid,batontx,hashBlock) != 0 && (numvouts= batontx.vout.size()) > 1 ) { if ( (funcid= MarmaraDecodeLoopOpret(batontx.vout[numvouts-1].scriptPubKey,refcreatetxid,pk,refamount,refmatures,refcurrency)) != 0 ) { @@ -593,7 +593,7 @@ UniValue MarmaraSettlement(uint64_t txfee,uint256 refbatontxid) pubkeys.push_back(mypk); for (i=1; i 1 ) + if ( myGetTransaction(creditloop[i],tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 1 ) { if ( (funcid= MarmaraDecodeLoopOpret(tx.vout[numvouts-1].scriptPubKey,createtxid,pk,amount,matures,currency)) != 0 ) { @@ -674,7 +674,7 @@ int32_t MarmaraGetCreditloops(int64_t &totalamount,std::vector &issuanc txid = it->first.txhash; vout = (int32_t)it->first.index; //fprintf(stderr,"txid.%s/v%d\n",txid.GetHex().c_str(),vout); - if ( vout == 1 && GetTransaction(txid,tx,hashBlock,false) != 0 ) + if ( vout == 1 && myGetTransaction(txid,tx,hashBlock) != 0 ) { if ( tx.IsCoinBase() == 0 && (numvouts= tx.vout.size()) > 2 && tx.vout[numvouts - 1].nValue == 0 ) { @@ -814,7 +814,7 @@ UniValue MarmaraCreditloop(uint256 txid) cp = CCinit(&C,EVAL_MARMARA); if ( (n= MarmaraGetbatontxid(creditloop,batontxid,txid)) > 0 ) { - if ( GetTransaction(batontxid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 1 ) + if ( myGetTransaction(batontxid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 1 ) { result.push_back(Pair("result",(char *)"success")); Getscriptaddress(coinaddr,CScript() << ParseHex(HexStr(Mypubkey())) << OP_CHECKSIG); @@ -886,7 +886,7 @@ UniValue MarmaraCreditloop(uint256 txid) } for (i=0; i 1 ) + if ( myGetTransaction(creditloop[i],tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 1 ) { if ( (funcid= MarmaraDecodeLoopOpret(tx.vout[numvouts-1].scriptPubKey,createtxid,pk,amount,matures,currency)) != 0 ) { diff --git a/src/cc/oracles.cpp b/src/cc/oracles.cpp index bdd01ccfa..5056ccade 100644 --- a/src/cc/oracles.cpp +++ b/src/cc/oracles.cpp @@ -759,7 +759,7 @@ int64_t AddOracleInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,uint txid = it->first.txhash; vout = (int32_t)it->first.index; //char str[65]; fprintf(stderr,"oracle check %s/v%d\n",uint256_str(str,txid),vout); - if ( GetTransaction(txid,vintx,hashBlock,false) != 0 && (numvouts=vintx.vout.size()-1)>0) + if ( myGetTransaction(txid,vintx,hashBlock) != 0 && (numvouts=vintx.vout.size()-1)>0) { if ((funcid=DecodeOraclesOpRet(vintx.vout[numvouts].scriptPubKey,tmporacletxid,tmppk,tmpnum))!=0 && (funcid=='S' || funcid=='D')) { @@ -795,7 +795,7 @@ int64_t LifetimeOraclesFunds(struct CCcontract_info *cp,uint256 oracletxid,CPubK for (std::vector >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++) { txid = it->first.txhash; - if ( GetTransaction(txid,subtx,hashBlock,false) != 0 ) + if ( myGetTransaction(txid,subtx,hashBlock) != 0 ) { if ( subtx.vout.size() > 0 && DecodeOraclesOpRet(subtx.vout[subtx.vout.size()-1].scriptPubKey,subtxid,pk,num) == 'S' && subtxid == oracletxid && pk == publisher ) { @@ -818,7 +818,7 @@ int64_t AddMyOraclesFunds(struct CCcontract_info *cp,CMutableTransaction &mtx,CP txid = it->first.txhash; vout = (int32_t)it->first.index; nValue = it->second.satoshis; - if ( GetTransaction(txid,vintx,hashBlock,false) != 0 && (numvouts=vintx.vout.size())>0) + if ( myGetTransaction(txid,vintx,hashBlock) != 0 && (numvouts=vintx.vout.size())>0) { if ((funcid=DecodeOraclesOpRet(vintx.vout[numvouts-1].scriptPubKey,tmporacletxid,tmppk,tmpamount))!=0 && funcid=='F' && tmppk==pk && tmporacletxid==oracletxid && tmpamount==nValue && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout)==0) @@ -986,7 +986,7 @@ std::string OracleData(int64_t txfee,uint256 oracletxid,std::vector da fprintf(stderr,"%s\n", CCerror.c_str() ); return(""); } - if ( GetTransaction(oracletxid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size()) > 0 ) + if ( myGetTransaction(oracletxid,tx,hashBlock) != 0 && (numvouts=tx.vout.size()) > 0 ) { if ( DecodeOraclesCreateOpRet(tx.vout[numvouts-1].scriptPubKey,name,description,format) == 'C' ) { @@ -1061,11 +1061,11 @@ UniValue OracleDataSample(uint256 reforacletxid,uint256 txid) CPubKey pk; std::string name,description,format; int32_t numvouts; std::vector data; char str[67], *formatstr = 0; result.push_back(Pair("result","success")); - if ( GetTransaction(reforacletxid,oracletx,hashBlock,false) != 0 && (numvouts=oracletx.vout.size()) > 0 ) + if ( myGetTransaction(reforacletxid,oracletx,hashBlock) != 0 && (numvouts=oracletx.vout.size()) > 0 ) { if ( DecodeOraclesCreateOpRet(oracletx.vout[numvouts-1].scriptPubKey,name,description,format) == 'C' ) { - if ( GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size()) > 0 ) + if ( myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size()) > 0 ) { if ( DecodeOraclesData(tx.vout[numvouts-1].scriptPubKey,oracletxid,btxid,pk,data) == 'D' && reforacletxid == oracletxid ) { @@ -1094,7 +1094,7 @@ UniValue OracleDataSamples(uint256 reforacletxid,char* batonaddr,int32_t num) std::vector > addressIndex; int64_t nValue; result.push_back(Pair("result","success")); - if ( GetTransaction(reforacletxid,oracletx,hashBlock,false) != 0 && (numvouts=oracletx.vout.size()) > 0 ) + if ( myGetTransaction(reforacletxid,oracletx,hashBlock) != 0 && (numvouts=oracletx.vout.size()) > 0 ) { if ( DecodeOraclesCreateOpRet(oracletx.vout[numvouts-1].scriptPubKey,name,description,format) == 'C' ) { @@ -1122,7 +1122,7 @@ UniValue OracleDataSamples(uint256 reforacletxid,char* batonaddr,int32_t num) txid=it->first.txhash; vout = (int32_t)it->first.index; nValue = (int64_t)it->second; - if (vout==1 && nValue==10000 && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size()) > 0 ) + if (vout==1 && nValue==10000 && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size()) > 0 ) { if ( DecodeOraclesData(tx.vout[numvouts-1].scriptPubKey,oracletxid,btxid,pk,data) == 'D' && reforacletxid == oracletxid ) { @@ -1155,14 +1155,14 @@ UniValue OracleInfo(uint256 origtxid) cp = CCinit(&C,EVAL_ORACLES); CCtxidaddr(markeraddr,origtxid); - if ( GetTransaction(origtxid,tx,hashBlock,false) == 0 ) + if ( myGetTransaction(origtxid,tx,hashBlock) == 0 ) { fprintf(stderr,"cant find oracleid\n"); result.push_back(Pair("result","error")); result.push_back(Pair("error","cant find oracleid")); return(result); } - if ( GetTransaction(origtxid,tx,hashBlock,false) != 0 ) + if ( myGetTransaction(origtxid,tx,hashBlock) != 0 ) { if ( tx.vout.size() > 0 && DecodeOraclesCreateOpRet(tx.vout[tx.vout.size()-1].scriptPubKey,name,description,format) == 'C' ) { @@ -1177,7 +1177,7 @@ UniValue OracleInfo(uint256 origtxid) { txid = it->first.txhash; height = (int32_t)it->second.blockHeight; - if ( GetTransaction(txid,tx,hashBlock,false) != 0 && tx.vout.size() > 0 && + if ( myGetTransaction(txid,tx,hashBlock) != 0 && tx.vout.size() > 0 && DecodeOraclesOpRet(tx.vout[tx.vout.size()-1].scriptPubKey,oracletxid,pk,datafee) == 'R' && oracletxid == origtxid ) { if (publishers.find(pk)==publishers.end() || height>publishers[pk].second) @@ -1189,7 +1189,7 @@ UniValue OracleInfo(uint256 origtxid) } for (std::map>::iterator it = publishers.begin(); it != publishers.end(); ++it) { - if ( GetTransaction(it->second.first,tx,hashBlock,false) != 0 && DecodeOraclesOpRet(tx.vout[tx.vout.size()-1].scriptPubKey,oracletxid,pk,datafee) == 'R') + if ( myGetTransaction(it->second.first,tx,hashBlock) != 0 && DecodeOraclesOpRet(tx.vout[tx.vout.size()-1].scriptPubKey,oracletxid,pk,datafee) == 'R') { UniValue obj(UniValue::VOBJ); obj.push_back(Pair("publisher",pubkey33_str(str,(uint8_t *)pk.begin()))); @@ -1222,7 +1222,7 @@ UniValue OraclesList() for (std::vector >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++) { txid = it->first.txhash; - if ( GetTransaction(txid,createtx,hashBlock,false) != 0 ) + if ( myGetTransaction(txid,createtx,hashBlock) != 0 ) { if ( createtx.vout.size() > 0 && DecodeOraclesCreateOpRet(createtx.vout[createtx.vout.size()-1].scriptPubKey,name,description,format) == 'C' ) { diff --git a/src/cc/payments.cpp b/src/cc/payments.cpp index be4d63271..17507a80e 100644 --- a/src/cc/payments.cpp +++ b/src/cc/payments.cpp @@ -559,7 +559,7 @@ int64_t AddPaymentsInputs(bool fLockedBlocks,int8_t GetBalance,struct CCcontract txid = it->first.txhash; vout = (int32_t)it->first.index; //fprintf(stderr,"iter.%d %s/v%d %s\n",iter,txid.GetHex().c_str(),vout,coinaddr); - if ( GetTransaction(txid,vintx,hashBlock,false) != 0 ) + if ( myGetTransaction(txid,vintx,hashBlock) != 0 ) { if ( (nValue= IsPaymentsvout(cp,vintx,vout,coinaddr,ccopret)) > PAYMENTS_TXFEE && nValue >= threshold && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 ) { diff --git a/src/cc/pegs.cpp b/src/cc/pegs.cpp index 96c41b9ff..4c3d659ae 100644 --- a/src/cc/pegs.cpp +++ b/src/cc/pegs.cpp @@ -382,7 +382,7 @@ int64_t AddPegsInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKe txid = it->first.txhash; vout = (int32_t)it->first.index; // no need to prevent dup - if ( GetTransaction(txid,vintx,hashBlock,false) != 0 ) + if ( myGetTransaction(txid,vintx,hashBlock) != 0 ) { if (myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 ) { @@ -413,7 +413,7 @@ int64_t AddPegsTokenInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,u txid = it->first.txhash; vout = (int32_t)it->first.index; // no need to prevent dup - if ( GetTransaction(txid,vintx,hashBlock,false) != 0 ) + if ( myGetTransaction(txid,vintx,hashBlock) != 0 ) { if (myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 && DecodePegsOpRet(vintx,tmppegstxid,tmptokenid)!=0 && tmppegstxid==pegstxid && tmptokenid==tokenid) { @@ -521,7 +521,7 @@ double PegsGetTokenPrice(uint256 tokenid) int64_t *tokensyn,*btcusd; double price; CTransaction tokentx; uint256 hashBlock; std::string name,desc; std::vector vorigpubkey; int32_t numvouts; - if (GetTransaction(tokenid,tokentx,hashBlock,false)!=0 && (numvouts=tokentx.vout.size())>0 && DecodeTokenCreateOpRet(tokentx.vout[numvouts-1].scriptPubKey,vorigpubkey,name,desc)=='c') + if (myGetTransaction(tokenid,tokentx,hashBlock)!=0 && (numvouts=tokentx.vout.size())>0 && DecodeTokenCreateOpRet(tokentx.vout[numvouts-1].scriptPubKey,vorigpubkey,name,desc)=='c') { tokensyn = (int64_t *)calloc(sizeof(*tokensyn) * 3, 1 + PRICES_DAYWINDOW * 2 + PRICES_SMOOTHWIDTH); btcusd = (int64_t *)calloc(sizeof(*btcusd) * 3, 1 + PRICES_DAYWINDOW * 2 + PRICES_SMOOTHWIDTH); @@ -539,7 +539,7 @@ std::string PegsGetTokenName(uint256 tokenid) { CTransaction tokentx; uint256 hashBlock; std::string name,desc; std::vector vorigpubkey; int32_t numvouts; - if (GetTransaction(tokenid,tokentx,hashBlock,false)!=0 && (numvouts=tokentx.vout.size())>0 && DecodeTokenCreateOpRet(tokentx.vout[numvouts-1].scriptPubKey,vorigpubkey,name,desc)=='c') + if (myGetTransaction(tokenid,tokentx,hashBlock,false)!=0 && (numvouts=tokentx.vout.size())>0 && DecodeTokenCreateOpRet(tokentx.vout[numvouts-1].scriptPubKey,vorigpubkey,name,desc)=='c') { return (name); } @@ -555,7 +555,7 @@ double PegsGetAccountRatio(uint256 pegstxid,uint256 tokenid,uint256 accounttxid) std::pair account; struct CCcontract_info *cp,C; cp = CCinit(&C,EVAL_PEGS); - if (GetTransaction(accounttxid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size())>0 && + if (myGetTransaction(accounttxid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 && (funcid=DecodePegsOpRet(tx,tmppegstxid,tmptokenid))!=0 && pegstxid==tmppegstxid && tokenid==tmptokenid) { PegsDecodeAccountTx(tx,pk,amount,account); @@ -581,7 +581,7 @@ double PegsGetGlobalRatio(uint256 pegstxid) txid = it->first.txhash; vout = (int32_t)it->first.index; nValue = (int64_t)it->second.satoshis; - if (vout == 0 && nValue == CC_MARKER_VALUE && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size())>0 && + if (vout == 0 && nValue == CC_MARKER_VALUE && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 && (funcid=DecodePegsOpRet(tx,tmppegstxid,tokenid))!=0 && pegstxid==tmppegstxid && (funcid=='F' || funcid=='G' || funcid=='E')) { PegsDecodeAccountTx(tx,pk,amount,account); @@ -597,7 +597,7 @@ double PegsGetGlobalRatio(uint256 pegstxid) txid = it->first.txhash; vout = (int32_t)it->first.index; nValue = (int64_t)it->second.satoshis; - if (GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size())>0 && DecodePegsOpRet(tx,tmppegstxid,tokenid)!=0 && pegstxid==tmppegstxid) + if (myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 && DecodePegsOpRet(tx,tmppegstxid,tokenid)!=0 && pegstxid==tmppegstxid) { globalaccounts[tokenid].first+=nValue; } @@ -660,7 +660,7 @@ std::string PegsCreate(uint64_t txfee,int64_t amount, std::vector bindt pegspk = GetUnspendable(cp,0); for(auto txid : bindtxids) { - if (GetTransaction(txid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0) + if (myGetTransaction(txid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0) { CCerror = strprintf("cant find bindtxid %s",txid.GetHex()); LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -697,7 +697,7 @@ std::string PegsFund(uint64_t txfee,uint256 pegstxid, uint256 tokenid,int64_t am mypk = pubkey2pk(Mypubkey()); pegspk = GetUnspendable(cp,0); - if (GetTransaction(pegstxid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0) + if (,yGetTransaction(pegstxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0) { CCerror = strprintf("cant find pegstxid %s",pegstxid.GetHex()); LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -711,7 +711,7 @@ std::string PegsFund(uint64_t txfee,uint256 pegstxid, uint256 tokenid,int64_t am } for(auto txid : bindtxids) { - if (GetTransaction(txid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0) + if (myGetTransaction(txid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0) { CCerror = strprintf("cant find bindtxid %s",txid.GetHex()); LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -794,7 +794,7 @@ std::string PegsGet(uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64_t am txfee = 10000; mypk = pubkey2pk(Mypubkey()); pegspk = GetUnspendable(cp,0); - if (GetTransaction(pegstxid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0) + if (myGetTransaction(pegstxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0) { CCerror = strprintf("cant find pegstxid %s",pegstxid.GetHex()); LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -855,7 +855,7 @@ std::string PegsRedeem(uint64_t txfee,uint256 pegstxid, uint256 tokenid) txfee = 10000; mypk = pubkey2pk(Mypubkey()); pegspk = GetUnspendable(cp,0); - if (GetTransaction(pegstxid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0) + if (myGetTransaction(pegstxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0) { CCerror = strprintf("cant find pegstxid %s",pegstxid.GetHex()); LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -869,7 +869,7 @@ std::string PegsRedeem(uint64_t txfee,uint256 pegstxid, uint256 tokenid) } for(auto txid : bindtxids) { - if (GetTransaction(txid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0) + if (myGetTransaction(txid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0) { CCerror = strprintf("cant find bindtxid %s",txid.GetHex()); LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -968,7 +968,7 @@ std::string PegsExchange(uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64 txfee = 10000; mypk = pubkey2pk(Mypubkey()); pegspk = GetUnspendable(cp,0); - if (GetTransaction(pegstxid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0) + if (myGetTransaction(pegstxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0) { CCerror = strprintf("cant find pegstxid %s",pegstxid.GetHex()); LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -982,7 +982,7 @@ std::string PegsExchange(uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64 } for(auto txid : bindtxids) { - if (GetTransaction(txid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0) + if (myGetTransaction(txid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0) { CCerror = strprintf("cant find bindtxid %s",txid.GetHex()); LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -1026,7 +1026,7 @@ std::string PegsExchange(uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64 LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - if (accounttxid!=zeroid && GetTransaction(accounttxid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0 || PegsDecodeAccountTx(tx,tmppk,tmpamount,account).empty()) + if (accounttxid!=zeroid && myGetTransaction(accounttxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0 || PegsDecodeAccountTx(tx,tmppk,tmpamount,account).empty()) { CCerror = strprintf("invalid account tx from which to exchange coins to tokens %s!",accounttxid.GetHex()); LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -1104,7 +1104,7 @@ std::string PegsLiquidate(uint64_t txfee,uint256 pegstxid, uint256 tokenid, uint txfee = 10000; mypk = pubkey2pk(Mypubkey()); pegspk = GetUnspendable(cp,0); - if (GetTransaction(pegstxid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0) + if (myGetTransaction(pegstxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0) { CCerror = strprintf("cant find pegstxid %s",pegstxid.GetHex()); LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -1118,7 +1118,7 @@ std::string PegsLiquidate(uint64_t txfee,uint256 pegstxid, uint256 tokenid, uint } for(auto txid : bindtxids) { - if (GetTransaction(txid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0) + if (myGetTransaction(txid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0) { CCerror = strprintf("cant find bindtxid %s",txid.GetHex()); LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -1160,7 +1160,7 @@ std::string PegsLiquidate(uint64_t txfee,uint256 pegstxid, uint256 tokenid, uint LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl); return(""); } - if (liquidatetxid!=zeroid && GetTransaction(liquidatetxid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0 || PegsDecodeAccountTx(tx,tmppk,amount,account).empty()) + if (liquidatetxid!=zeroid && myGetTransaction(liquidatetxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0 || PegsDecodeAccountTx(tx,tmppk,amount,account).empty()) { CCerror = strprintf("cannot find account to liquidate or invalid tx %s!",liquidatetxid.GetHex()); LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl); @@ -1235,7 +1235,7 @@ UniValue PegsAccountHistory(uint256 pegstxid) txid = it->first.txhash; vout = (int32_t)it->first.index; nValue = (int64_t)it->second; - if (vout == 1 && nValue == CC_MARKER_VALUE && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size())>0 && + if (vout == 1 && nValue == CC_MARKER_VALUE && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 && (funcid=DecodePegsOpRet(tx,tmppegstxid,tmptokenid))!=0 && pegstxid==tmppegstxid) { UniValue obj(UniValue::VOBJ); @@ -1272,7 +1272,7 @@ UniValue PegsAccountInfo(uint256 pegstxid) vout = (int32_t)it->first.index; nValue = (int64_t)it->second.satoshis; //LOGSTREAM("pegscc",CCLOG_DEBUG2, stream << "txid=" << txid.GetHex() << ", vout=" << vout << ", nValue=" << nValue << std::endl); - if (vout == 1 && nValue == CC_MARKER_VALUE && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size())>0 && + if (vout == 1 && nValue == CC_MARKER_VALUE && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 && (funcid=DecodePegsOpRet(tx,tmppegstxid,tmptokenid))!=0 && pegstxid==tmppegstxid) { //LOGSTREAM("pegscc",CCLOG_DEBUG2, stream << "txid=" << txid.GetHex() << ", vout=" << vout << ", nValue=" << nValue << ", tokenid=" << tmptokenid.GetHex() << std::endl); @@ -1314,7 +1314,7 @@ UniValue PegsWorstAccounts(uint256 pegstxid) txid = it->first.txhash; vout = (int32_t)it->first.index; nValue = (int64_t)it->second.satoshis; - if (vout == 0 && nValue == CC_MARKER_VALUE && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size())>0 && + if (vout == 0 && nValue == CC_MARKER_VALUE && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 && (funcid=DecodePegsOpRet(tx,tmppegstxid,tokenid))!=0 && pegstxid==tmppegstxid) { PegsDecodeAccountTx(tx,pk,amount,account); @@ -1366,7 +1366,7 @@ UniValue PegsInfo(uint256 pegstxid) txid = it->first.txhash; vout = (int32_t)it->first.index; nValue = (int64_t)it->second.satoshis; - if (vout == 0 && nValue == CC_MARKER_VALUE && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size())>0 && + if (vout == 0 && nValue == CC_MARKER_VALUE && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 && (funcid=DecodePegsOpRet(tx,tmppegstxid,tokenid))!=0 && pegstxid==tmppegstxid) { PegsDecodeAccountTx(tx,pk,amount,account); @@ -1382,7 +1382,7 @@ UniValue PegsInfo(uint256 pegstxid) txid = it->first.txhash; vout = (int32_t)it->first.index; nValue = (int64_t)it->second.satoshis; - if (GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size())>0 && DecodePegsOpRet(tx,tmppegstxid,tokenid)!=0 && pegstxid==tmppegstxid) + if (myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 && DecodePegsOpRet(tx,tmppegstxid,tokenid)!=0 && pegstxid==tmppegstxid) { globalaccounts[tokenid].first+=nValue; } diff --git a/src/cc/prices.cpp b/src/cc/prices.cpp index 2c0a33b20..0fcc2e512 100644 --- a/src/cc/prices.cpp +++ b/src/cc/prices.cpp @@ -590,7 +590,7 @@ int64_t AddPricesInputs(struct CCcontract_info *cp, CMutableTransaction &mtx, ch vout = (int32_t)it->first.index; //if (vout == exclvout && txid == excltxid) // exclude vout which is added directly to vins outside this function // continue; - if (GetTransaction(txid, vintx, hashBlock, false) != 0 && vout < vintx.vout.size()) + if (myGetTransaction(txid, vintx, hashBlock) != 0 && vout < vintx.vout.size()) { vscript_t vopret; uint8_t funcId = PricesCheckOpret(vintx, vopret); @@ -2161,7 +2161,7 @@ UniValue PricesList(uint32_t filter, CPubKey mypk) std::vector vec; CTransaction vintx; - if (GetTransaction(txid, vintx, hashBlock, false) != 0) + if (myGetTransaction(txid, vintx, hashBlock) != 0) { // TODO: forget old tx diff --git a/src/cc/rewards.cpp b/src/cc/rewards.cpp index 2edd275ec..2d6399737 100644 --- a/src/cc/rewards.cpp +++ b/src/cc/rewards.cpp @@ -357,7 +357,7 @@ int64_t AddRewardsInputs(CScript &scriptPubKey,uint64_t maxseconds,struct CCcont break; if ( j != mtx.vin.size() ) continue; - if ( GetTransaction(txid,tx,hashBlock,false) != 0 && tx.vout.size() > 0 && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 ) + if ( myGetTransaction(txid,tx,hashBlock) != 0 && tx.vout.size() > 0 && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 ) { if ( (funcid= DecodeRewardsOpRet(txid,tx.vout[tx.vout.size()-1].scriptPubKey,sbits,fundingtxid)) != 0 ) { @@ -409,7 +409,7 @@ int64_t RewardsPlanFunds(uint64_t &lockedfunds,uint64_t refsbits,struct CCcontra { txid = it->first.txhash; vout = (int32_t)it->first.index; - if ( GetTransaction(txid,tx,hashBlock,false) != 0 && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 ) + if ( myGetTransaction(txid,tx,hashBlock) != 0 && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 ) { if ( (funcid= DecodeRewardsOpRet(txid,tx.vout[tx.vout.size()-1].scriptPubKey,sbits,fundingtxid)) == 'F' || funcid == 'A' || funcid == 'U' || funcid == 'L' ) { @@ -439,7 +439,7 @@ bool RewardsPlanExists(struct CCcontract_info *cp,uint64_t refsbits,CPubKey rewa { //int height = it->first.blockHeight; txid = it->first.txhash; - if ( GetTransaction(txid,tx,hashBlock,false) != 0 && tx.vout.size() > 0 && ConstrainVout(tx.vout[0],1,CCaddr,0) != 0 ) + if ( myGetTransaction(txid,tx,hashBlock) != 0 && tx.vout.size() > 0 && ConstrainVout(tx.vout[0],1,CCaddr,0) != 0 ) { //char str[65]; fprintf(stderr,"rewards plan %s\n",uint256_str(str,txid)); if ( DecodeRewardsFundingOpRet(tx.vout[tx.vout.size()-1].scriptPubKey,sbits,APR,minseconds,maxseconds,mindeposit) == 'F' ) @@ -455,7 +455,7 @@ bool RewardsPlanExists(struct CCcontract_info *cp,uint64_t refsbits,CPubKey rewa UniValue RewardsInfo(uint256 rewardsid) { UniValue result(UniValue::VOBJ); uint256 hashBlock; CTransaction vintx; uint64_t lockedfunds,APR,minseconds,maxseconds,mindeposit,sbits,funding; CPubKey rewardspk; struct CCcontract_info *cp,C; char str[67],numstr[65]; - if ( GetTransaction(rewardsid,vintx,hashBlock,false) == 0 ) + if ( myGetTransaction(rewardsid,vintx,hashBlock) == 0 ) { fprintf(stderr,"cant find fundingtxid\n"); result.push_back(Pair("result","error")); @@ -498,7 +498,7 @@ UniValue RewardsList() for (std::vector >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++) { txid = it->first.txhash; - if ( GetTransaction(txid,vintx,hashBlock,false) != 0 ) + if ( myGetTransaction(txid,vintx,hashBlock) != 0 ) { if ( vintx.vout.size() > 0 && DecodeRewardsFundingOpRet(vintx.vout[vintx.vout.size()-1].scriptPubKey,sbits,APR,minseconds,maxseconds,mindeposit) != 0 ) { @@ -657,7 +657,7 @@ std::string RewardsUnlock(uint64_t txfee,char *planstr,uint256 fundingtxid,uint2 CCerror = "locktxid/v0 is spent"; return(""); } - if ( GetTransaction(locktxid,tx,hashBlock,false) != 0 && tx.vout.size() > 0 && tx.vout[1].scriptPubKey.IsPayToCryptoCondition() == 0 ) + if ( myGetTransaction(locktxid,tx,hashBlock) != 0 && tx.vout.size() > 0 && tx.vout[1].scriptPubKey.IsPayToCryptoCondition() == 0 ) { scriptPubKey = tx.vout[1].scriptPubKey; mtx.vin.push_back(CTxIn(locktxid,0,CScript())); diff --git a/src/cc/sudoku.cpp b/src/cc/sudoku.cpp index 61ea6c545..8017799ba 100644 --- a/src/cc/sudoku.cpp +++ b/src/cc/sudoku.cpp @@ -2730,7 +2730,7 @@ UniValue sudoku_txidinfo(uint64_t txfee,struct CCcontract_info *cp,cJSON *params decode_hex((uint8_t *)&txid,32,txidstr); txid = revuint256(txid); result.push_back(Pair("txid",txid.GetHex())); - if ( GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 1 ) + if ( myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 1 ) { if ( sudoku_genopreturndecode(unsolved,tx.vout[numvouts-1].scriptPubKey) == 'G' ) { @@ -2780,7 +2780,7 @@ UniValue sudoku_pending(uint64_t txfee,struct CCcontract_info *cp,cJSON *params) //char str[65]; fprintf(stderr,"%s check %s/v%d %.8f\n",coinaddr,uint256_str(str,txid),vout,(double)it->second.satoshis/COIN); if ( it->second.satoshis != txfee || vout != 0 ) continue; - if ( GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 1 ) + if ( myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 1 ) { if ( (nValue= IsCClibvout(cp,tx,vout,coinaddr)) == txfee && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 ) { @@ -2861,7 +2861,7 @@ UniValue sudoku_solution(uint64_t txfee,struct CCcontract_info *cp,cJSON *params result.push_back(Pair("txid",txid.GetHex())); if ( CCgettxout(txid,0,1,0) < 0 ) result.push_back(Pair("error","already solved")); - else if ( GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 1 ) + else if ( myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 1 ) { Getscriptaddress(checkaddr,tx.vout[1].scriptPubKey); if ( strcmp(checkaddr,CCaddr) != 0 ) diff --git a/src/rpc/crosschain.cpp b/src/rpc/crosschain.cpp index 8407439ff..076e89a03 100644 --- a/src/rpc/crosschain.cpp +++ b/src/rpc/crosschain.cpp @@ -430,7 +430,7 @@ void CheckBurnTxSource(uint256 burntxid, UniValue &info) { CTransaction burnTx; uint256 blockHash; - if (!GetTransaction(burntxid, burnTx, blockHash, true)) + if (!myGetTransaction(burntxid, burnTx, blockHash)) throw std::runtime_error("Cannot find burn transaction"); if (blockHash.IsNull()) @@ -1157,7 +1157,7 @@ UniValue getNotarisationsForBlock(const UniValue& params, bool fHelp) { UniValue item(UniValue::VOBJ); UniValue notaryarr(UniValue::VARR); std::vector NotarisationNotaries; uint256 hash; CTransaction tx; - if ( GetTransaction(n.first,tx,hash,false) ) + if ( myGetTransaction(n.first,tx,hash) ) { if ( is_STAKED(n.second.symbol) != 0 ) {