From 7fbc6c5f95daad2e736a13427061f23cafb38a92 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 2 Apr 2019 10:34:58 -1100 Subject: [PATCH] Arg --- src/komodo_gateway.h | 7 +++++-- src/rpc/blockchain.cpp | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 63e6898eb..0d4274ae5 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -2240,7 +2240,7 @@ char *komodo_pricename(char *name,int32_t ind) return(0); } -int64_t komodo_pricecorrelated(uint64_t seed,int32_t ind,uint32_t *rawprices,int32_t daywindow,uint32_t *nonzprices) +int64_t komodo_pricecorrelated(uint64_t seed,int32_t ind,uint32_t *rawprices,int32_t daywindow,uint32_t *nonzprices,int32_t smoothwidth) { int32_t i,j,k,n,iter,correlation,maxcorrelation=0; int64_t firstprice,price,sum,den,mult,refprice,lowprice,highprice; if ( daywindow < 2 ) @@ -2249,7 +2249,7 @@ int64_t komodo_pricecorrelated(uint64_t seed,int32_t ind,uint32_t *rawprices,int mult = 10000; else mult = 1; memset(nonzprices,0,sizeof(*nonzprices)*daywindow); - for (iter=0; iter= daywindow ) i = 0; if ( (price= rawprices[i]) == 0 ) + { + fprintf(stderr,"null rawprice.[%d]\n",i); return(-1); + } if ( price >= lowprice && price <= highprice ) { //fprintf(stderr,"%.1f ",(double)price/10000); diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index e31f5d8a4..6e6746a30 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1177,7 +1177,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 numprices,int64_t *correlated2,int32_t smoothwidth); -int64_t komodo_pricecorrelated(uint64_t seed,int32_t ind,uint32_t *rawprices,int32_t numprices,uint32_t *rawprices2); +int64_t komodo_pricecorrelated(uint64_t seed,int32_t ind,uint32_t *rawprices,int32_t numprices,uint32_t *rawprices2,int32_t smoothwidth); int32_t komodo_nextheight(); uint32_t komodo_heightstamp(int32_t height); @@ -1243,7 +1243,7 @@ UniValue prices(const UniValue& params, bool fHelp) { offset = j*width + i; rngval = (rngval*11109 + 13849); - if ( (correlated[i]= komodo_pricecorrelated(rngval,j,&prices[offset],daywindow+smoothwidth,prices2)) < 0 ) + if ( (correlated[i]= komodo_pricecorrelated(rngval,j,&prices[offset],daywindow+smoothwidth,prices2,smoothwidth)) < 0 ) throw JSONRPCError(RPC_INVALID_PARAMETER, "null correlated price"); } for (i=0; i