Only skip check if localbits is 0

This commit is contained in:
jl777
2019-03-29 08:27:16 -11:00
parent eb4c6419fd
commit 78dd8ae937

View File

@@ -1612,7 +1612,7 @@ int32_t komodo_pricecmp(int32_t n,int32_t *maxflagp,uint32_t *pricebitsA,uint32_
for (i=1; i<n; i++) for (i=1; i<n; i++)
{ {
*maxflagp = 0; *maxflagp = 0;
if ( pricebitsB[i] != 0 && pricebitsA[i] != 0 && (newprice= komodo_pricenew(maxflagp,pricebitsA[i],pricebitsB[i],tolerance)) != 0 ) if ( (newprice= komodo_pricenew(maxflagp,pricebitsA[i],pricebitsB[i],tolerance)) != 0 )
{ {
fprintf(stderr,"i.%d/%d %u vs %u -> newprice.%u out of tolerance maxflag.%d\n",i,n,pricebitsB[i],pricebitsA[i],newprice,*maxflagp); fprintf(stderr,"i.%d/%d %u vs %u -> newprice.%u out of tolerance maxflag.%d\n",i,n,pricebitsB[i],pricebitsA[i],newprice,*maxflagp);
return(-1); return(-1);
@@ -1711,6 +1711,11 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey)
if ( lag < ASSETCHAINS_BLOCKTIME && Mineropret.size() >= PRICES_SIZEBIT0 ) if ( lag < ASSETCHAINS_BLOCKTIME && Mineropret.size() >= PRICES_SIZEBIT0 )
{ {
memcpy(localbits,Mineropret.data(),Mineropret.size()); memcpy(localbits,Mineropret.data(),Mineropret.size());
for (i=0; i<n; i++)
if ( localbits[i] == 0 )
break;
if ( i == n )
{
if ( maxflag == 0 ) if ( maxflag == 0 )
{ {
if ( komodo_pricecmp(n,&maxflag,localbits,prevbits,PRICES_MAXCHANGE) < 0 ) if ( komodo_pricecmp(n,&maxflag,localbits,prevbits,PRICES_MAXCHANGE) < 0 )
@@ -1736,6 +1741,7 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey)
} }
} }
} }
}
return(0); return(0);
} else fprintf(stderr,"wrong size %d vs %d, scriptPubKey size %d [%02x]\n",(int32_t)vopret.size(),(int32_t)Mineropret.size(),(int32_t)scriptPubKey.size(),scriptPubKey[0]); } else fprintf(stderr,"wrong size %d vs %d, scriptPubKey size %d [%02x]\n",(int32_t)vopret.size(),(int32_t)Mineropret.size(),(int32_t)scriptPubKey.size(),scriptPubKey[0]);
return(-1); return(-1);