Cross copy

This commit is contained in:
jl777
2019-04-02 01:33:28 -11:00
parent 0d94b7d7b8
commit 61e193953f

View File

@@ -1203,7 +1203,7 @@ UniValue prices(const UniValue& params, bool fHelp)
throw JSONRPCError(RPC_INVALID_PARAMETER, "illegal numpricefeeds");
prices = (uint32_t *)calloc(sizeof(*prices),width*numpricefeeds);
correlated = (int64_t *)calloc(sizeof(*correlated),width);
for (ht=nextheight-1,i=0; i<numpricefeeds&&ht>2*daywindow+2; i++,ht--)
for (ht=nextheight-1,i=0; i<width&&ht>2*daywindow+2; i++,ht--)
{
if ( ht < 0 || ht > chainActive.Height() )
throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range");
@@ -1215,8 +1215,12 @@ UniValue prices(const UniValue& params, bool fHelp)
throw JSONRPCError(RPC_INVALID_PARAMETER, "numprices != first numprices");
else
{
for (j=0; j<n; j++)
prices[j*width + i] = rawprices[i];
for (j=0; j<numpricefeeds; j++)
{
prices[j*width + i] = rawprices[j];
if ( j == 1 )
fprintf(stderr,"[%d] <- %.1f ",j*width+i,(double)rawprices[j]/10000)
}
}
} else throw JSONRPCError(RPC_INVALID_PARAMETER, "no komodo_rawprices found");
}