diff --git a/src/komodo_ccdata.h b/src/komodo_ccdata.h index 5dfc364c7..ab3ea04b0 100644 --- a/src/komodo_ccdata.h +++ b/src/komodo_ccdata.h @@ -206,7 +206,7 @@ void komodo_purge_ccdata(int32_t height) int32_t komodo_rwccdata(char *thischain,int32_t rwflag,struct komodo_ccdata *ccdata,struct komodo_ccdataMoMoM *MoMoMdata) { - uint256 hash,zero; bits256 tmp; int32_t i; struct komodo_ccdata *ptr; struct notarized_checkpoint *np; + uint256 hash,zero; bits256 tmp; int32_t i,nonz; struct komodo_ccdata *ptr; struct notarized_checkpoint *np; if ( rwflag == 0 ) { // load from disk @@ -217,9 +217,12 @@ int32_t komodo_rwccdata(char *thischain,int32_t rwflag,struct komodo_ccdata *ccd } if ( ccdata->MoMdata.height > 0 && (CC_firstheight == 0 || ccdata->MoMdata.height < CC_firstheight) ) CC_firstheight = ccdata->MoMdata.height; - for (i=0; i<32; i++) - tmp.bytes[i] = ((uint8_t *)&ccdata->MoMdata.MoM)[31-i]; - if ( bits256_nonz(tmp) == 0 ) + for (nonz=i=0; i<32; i++) + { + if ( (tmp.bytes[i]= ((uint8_t *)&ccdata->MoMdata.MoM)[31-i]) != 0 ) + nonz++; + } + if ( nonz == 0 ) return(0); memcpy(&hash,&tmp,sizeof(hash)); fprintf(stderr,"[%s] ccdata.%s id.%d notarized_ht.%d MoM.%s height.%d/t%d\n",ASSETCHAINS_SYMBOL,ccdata->symbol,ccdata->CCid,ccdata->MoMdata.notarized_height,hash.ToString().c_str(),ccdata->MoMdata.height,ccdata->MoMdata.txi);