diff --git a/src/cc/CCinclude.h b/src/cc/CCinclude.h index cdbe573b4..c1deb6248 100644 --- a/src/cc/CCinclude.h +++ b/src/cc/CCinclude.h @@ -116,6 +116,8 @@ int64_t AddAssetInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubK bool DecodeHexTx(CTransaction& tx, const std::string& strHexTx); bool DecodeAssetCreateOpRet(const CScript &scriptPubKey,std::vector &origpubkey,std::string &name,std::string &description); uint8_t DecodeAssetOpRet(const CScript &scriptPubKey,uint256 &assetid,uint256 &assetid2,int64_t &price,std::vector &origpubkey); +uint8_t DecodeOraclesData(const CScript &scriptPubKey,uint256 &oracletxid,uint256 &batontxid,CPubKey &pk,std::vector &data); +int32_t oracle_format(uint256 *hashp,int64_t *valp,char *str,uint8_t fmt,uint8_t *data,int32_t offset,int32_t datalen); // CCcustom CPubKey GetUnspendable(struct CCcontract_info *cp,uint8_t *unspendablepriv); diff --git a/src/cc/gateways.cpp b/src/cc/gateways.cpp index e1fe77f6f..be2b4f45f 100644 --- a/src/cc/gateways.cpp +++ b/src/cc/gateways.cpp @@ -309,12 +309,12 @@ std::string GatewaysBind(uint64_t txfee,std::string coin,uint256 tokenid,int64_t } if ( (fullsupply= CCfullsupply(tokenid)) != totalsupply ) { - fprintf(stderr,"Gateway bind.%s (%s) globaladdr.%s totalsupply %.8f != fullsupply %.8f\n",coin.c_str(),uint256_str(str,tokenid),(double)totalsupply/COIN,(double)fullsupply/COIN); + fprintf(stderr,"Gateway bind.%s (%s) globaladdr.%s totalsupply %.8f != fullsupply %.8f\n",coin.c_str(),uint256_str(str,tokenid),cp->unspendableCCaddr,(double)totalsupply/COIN,(double)fullsupply/COIN); return(""); } if ( CCtoken_balance(destaddr,tokenid) != totalsupply ) { - fprintf(stderr,"Gateway bind.%s (%s) globaladdr.%s token balance %.8f != %.8f\n",coin.c_str(),uint256_str(str,tokenid),(double)CCtoken_balance(destaddr,tokenid)/COIN,(double)totalsupply/COIN); + fprintf(stderr,"Gateway bind.%s (%s) globaladdr.%s token balance %.8f != %.8f\n",coin.c_str(),uint256_str(str,tokenid),cp->unspendableCCaddr,(double)CCtoken_balance(destaddr,tokenid)/COIN,(double)totalsupply/COIN); return(""); } if ( GetTransaction(oracletxid,oracletx,hashBlock,false) == 0 || (numvouts= oracletx.vout.size()) <= 0 ) @@ -332,11 +332,12 @@ std::string GatewaysBind(uint64_t txfee,std::string coin,uint256 tokenid,int64_t fprintf(stderr,"illegal format (%s) != (%s)\n",fstr,(char *)"Ihh"); return(""); } - if ( GatewaysBindExists(cp,gatewayspk,coin,tokenid) != 0 ) // dont forget to check mempool! + fprintf(stderr,"implement GatewaysBindExists\n"); + /*if ( GatewaysBindExists(cp,gatewayspk,coin,tokenid) != 0 ) // dont forget to check mempool! { fprintf(stderr,"Gateway bind.%s (%s) already exists\n",coin.c_str(),uint256_str(str,tokenid)); return(""); - } + }*/ if ( AddNormalinputs(mtx,mypk,2*txfee,60) > 0 ) { mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,gatewayspk)); @@ -348,7 +349,7 @@ std::string GatewaysBind(uint64_t txfee,std::string coin,uint256 tokenid,int64_t uint256 GatewaysReverseScan(uint256 &txid,int32_t height,uint256 reforacletxid,uint256 batontxid) { - CTransaction tx; uint256 hash,mhash; int64_t val; int32_t numvouts,merkleht; CPubKey pk; std::vectordata; + CTransaction tx; uint256 hash,mhash,hashBlock,oracletxid; int64_t val; int32_t numvouts,merkleht; CPubKey pk; std::vectordata; txid = zeroid; while ( GetTransaction(batontxid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 0 ) {