diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 8bc639050..ce89cea35 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -2519,7 +2519,7 @@ void smooth64(int64_t dest[],int64_t src[],int32_t width,int32_t smoothiters) // http://www.holoborodko.com/pavel/numerical-methods/noise-robust-smoothing-filter/ //const int64_t coeffs[7] = { -2, 0, 18, 32, 18, 0, -2 }; -int64_t komodo_pricesmoothed(int64_t *correlated,int32_t cskip) +int64_t komodo_priceave(int64_t *correlated,int32_t cskip) { int32_t i; int64_t sum=0,nonzprice,price; if ( PRICES_DAYWINDOW < 2 ) @@ -2615,7 +2615,7 @@ void komodo_pricesupdate(int32_t height,CBlock *pblock) fseek(PRICES[ind].fp,(height-PRICES_DAYWINDOW+1) * 3 * sizeof(int64_t),SEEK_SET); if ( fread(ptr64,sizeof(int64_t),PRICES_DAYWINDOW*3,PRICES[ind].fp) == PRICES_DAYWINDOW*3 ) { - if ( (smoothed= komodo_pricesmoothed(&ptr64[PRICES_DAYWINDOW*3-1],-3)) > 0 ) + if ( (smoothed= komodo_priceave(&ptr64[PRICES_DAYWINDOW*3-1],-3)) > 0 ) { fseek(PRICES[ind].fp,(height * 3 + 2) * sizeof(int64_t),SEEK_SET); if ( fwrite(&smoothed,1,sizeof(smoothed),PRICES[ind].fp) != sizeof(smoothed) ) diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 87f2658cd..07cb8a26d 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1176,7 +1176,7 @@ UniValue paxprice(const UniValue& params, bool fHelp) int32_t komodo_heightpricebits(uint64_t *seedp,uint32_t *heightbits,int32_t nHeight); char *komodo_pricename(char *name,int32_t ind); -int64_t komodo_pricesmoothed(int64_t *correlated,int32_t cskip); +int64_t komodo_priceave(int64_t *correlated,int32_t cskip); int64_t komodo_pricecorrelated(uint64_t seed,int32_t ind,uint32_t *rawprices,int32_t rawskip,uint32_t *nonzprices,int32_t smoothwidth); int32_t komodo_nextheight(); uint32_t komodo_heightstamp(int32_t height); @@ -1186,8 +1186,6 @@ int64_t komodo_pricemult(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; - //daywindow = (3600*24/ASSETCHAINS_BLOCKTIME) + 1; - //pricedata = (uint32_t *)calloc(sizeof(*prices)*3,numblocks + daywindow*2 + PRICES_SMOOTHWIDTH); width = numblocks+PRICES_DAYWINDOW*2+PRICES_SMOOTHWIDTH; komodo_heightpricebits(&seed,rawprices,firstheight + numblocks - 1); if ( firstheight < width ) @@ -1205,21 +1203,15 @@ int32_t prices_extract(int64_t *pricedata,int32_t firstheight,int32_t numblocks, ptr[1] = rawprices[0]; // timestamp } rngval = seed; - //correlated2 = (int64_t *)calloc(sizeof(*correlated2),width); for (i=0; i2; i++,ht--) { @@ -1288,14 +1278,13 @@ UniValue prices(const UniValue& params, bool fHelp) { offset = j*width + i; rngval = (rngval*11109 + 13849); - //correlated2[i] = prices[offset]; if ( (correlated[i]= komodo_pricecorrelated(rngval,j,&prices[offset],1,0,PRICES_SMOOTHWIDTH)) < 0 ) throw JSONRPCError(RPC_INVALID_PARAMETER, "null correlated price"); } for (i=0; i