Fix off by one in PriceCache copy
This commit is contained in:
@@ -1567,8 +1567,12 @@ uint32_t PriceCache[KOMODO_LOCALPRICE_CACHESIZE][4+sizeof(Cryptos)/sizeof(*Crypt
|
|||||||
void komodo_PriceCache_shift()
|
void komodo_PriceCache_shift()
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
for (i=KOMODO_LOCALPRICE_CACHESIZE-1; i>=0; i--)
|
for (i=KOMODO_LOCALPRICE_CACHESIZE-1; i>0; i--)
|
||||||
|
{
|
||||||
memcpy(PriceCache[i],PriceCache[i-1],sizeof(PriceCache[i]));
|
memcpy(PriceCache[i],PriceCache[i-1],sizeof(PriceCache[i]));
|
||||||
|
//for (j=0; j<4+sizeof(Cryptos)/sizeof(*Cryptos)+sizeof(Forex)/sizeof(*Forex); j++)
|
||||||
|
// PriceCache[i][j] = PriceCache[i-1][j];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// komodo_heightpricebits() extracts the price data in the coinbase for nHeight
|
// komodo_heightpricebits() extracts the price data in the coinbase for nHeight
|
||||||
@@ -1787,7 +1791,7 @@ int32_t komodo_opretvalidate(const CBlock *block,CBlockIndex * const previndex,i
|
|||||||
{
|
{
|
||||||
for (i=1; i<n; i++)
|
for (i=1; i<n; i++)
|
||||||
{
|
{
|
||||||
if ( (maxflag= maxflags[i]) != 0 )
|
if ( (maxflag= maxflags[i]) != 0 && localbits[i] != 0 )
|
||||||
{
|
{
|
||||||
// make sure local price is moving in right direction
|
// make sure local price is moving in right direction
|
||||||
fprintf(stderr,"maxflag.%d i.%d localbits.%u vs pricebits.%u prevbits.%u\n",maxflag,i,localbits[i],pricebits[i],prevbits[i]);
|
fprintf(stderr,"maxflag.%d i.%d localbits.%u vs pricebits.%u prevbits.%u\n",maxflag,i,localbits[i],pricebits[i],prevbits[i]);
|
||||||
|
|||||||
@@ -1235,7 +1235,7 @@ UniValue prices(const UniValue& params, bool fHelp)
|
|||||||
if ( (str= komodo_pricename(name,j)) != 0 )
|
if ( (str= komodo_pricename(name,j)) != 0 )
|
||||||
{
|
{
|
||||||
item.push_back(Pair("name",str));
|
item.push_back(Pair("name",str));
|
||||||
fprintf(stderr,"%s from %d to %d width.%d\n",name,j*width,j*width+maxsamples+daywindow,width);
|
fprintf(stderr,"%s from %d to %d width.%d %d\n",name,j*width,j*width+maxsamples+daywindow,width,width*numpricefeeds);
|
||||||
for (i=0; i<maxsamples+daywindow; i++)
|
for (i=0; i<maxsamples+daywindow; i++)
|
||||||
{
|
{
|
||||||
offset = j*width + i;
|
offset = j*width + i;
|
||||||
|
|||||||
Reference in New Issue
Block a user