diff --git a/src/cc/CCPrices.h b/src/cc/CCPrices.h index 633cc32e2..3dbe6a87c 100644 --- a/src/cc/CCPrices.h +++ b/src/cc/CCPrices.h @@ -18,7 +18,6 @@ #define CC_PRICES_H #include "CCinclude.h" -int32_t prices_extract(int64_t *pricedata,int32_t firstheight,int32_t numblocks,int32_t ind); int32_t komodo_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks); #define PRICES_DAYWINDOW ((3600*24/ASSETCHAINS_BLOCKTIME) + 1) diff --git a/src/cc/prices.cpp b/src/cc/prices.cpp index 5d164d97e..407cd81fa 100644 --- a/src/cc/prices.cpp +++ b/src/cc/prices.cpp @@ -320,8 +320,7 @@ int32_t prices_syntheticvec(std::vector &vec,std::vector int64_t prices_syntheticprice(std::vector vec,int32_t height,int32_t minmax,int16_t leverage) { - int32_t i,ind,errcode,depth,retval = -1; uint16_t opcode; int64_t *pricedata,pricestack[4],price,den,a,b,c; - pricedata = (int64_t *)calloc(sizeof(*pricedata)*3,1 + PRICES_DAYWINDOW*2 + PRICES_SMOOTHWIDTH); + int32_t i,ind,errcode,depth,retval = -1; uint16_t opcode; int64_t pricedata[PRICES_MAXDATAPOINTS],pricestack[4],price,den,a,b,c; price = den = depth = errcode = 0; for (i=0; i vec,int32_t height,int32_t m { case 0: pricestack[depth] = 0; - if ( prices_extract(pricedata,height,1,ind) == 0 ) + if ( komodo_priceget(pricedata,ind,height,1) > 0 ) { if ( minmax == 0 ) pricestack[depth] = pricedata[2]; @@ -420,7 +419,6 @@ int64_t prices_syntheticprice(std::vector vec,int32_t height,int32_t m if ( errcode != 0 ) break; } - free(pricedata); if ( den == 0 ) return(-11); else if ( depth != 0 ) diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index c0a45e292..035d44662 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1156,7 +1156,7 @@ UniValue paxprice(const UniValue& params, bool fHelp) return ret; } -int32_t prices_extract(int64_t *pricedata,int32_t firstheight,int32_t numblocks,int32_t ind) +/*int32_t prices_extract(int64_t *pricedata,int32_t firstheight,int32_t numblocks,int32_t ind) { int32_t height,i,n,width,numpricefeeds = -1; uint64_t seed,ignore,rngval; uint32_t rawprices[1440*6],*ptr; int64_t *tmpbuf; width = numblocks+PRICES_DAYWINDOW*2+PRICES_SMOOTHWIDTH; @@ -1188,7 +1188,7 @@ int32_t prices_extract(int64_t *pricedata,int32_t firstheight,int32_t numblocks, pricedata[i*3+2] = komodo_priceave(tmpbuf,&pricedata[i*3+1],3); free(tmpbuf); return(0); -} +}*/ UniValue prices(const UniValue& params, bool fHelp) {