diff --git a/src/komodo.h b/src/komodo.h index 71209910d..1eda3e237 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -202,13 +202,20 @@ void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotar //#ifdef KOMODO_PAX else if ( pvals != 0 && numpvals > 0 ) { - fputc('V',fp); - if ( fwrite(&height,1,sizeof(height),fp) != sizeof(height) ) - errs++; - fputc(numpvals,fp); - if ( fwrite(pvals,sizeof(uint32_t),numpvals,fp) != numpvals ) - errs++; - komodo_pvals(height,pvals,numpvals); + int32_t nonz = 0; + for (i=0; i<32; i++) + if ( pvals[i] != 0 ) + nonz++; + if ( nonz >= 32 ) + { + fputc('V',fp); + if ( fwrite(&height,1,sizeof(height),fp) != sizeof(height) ) + errs++; + fputc(numpvals,fp); + if ( fwrite(pvals,sizeof(uint32_t),numpvals,fp) != numpvals ) + errs++; + komodo_pvals(height,pvals,numpvals); + } //printf("save pvals height.%d numpvals.%d\n",height,numpvals); } //#endif diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index e19986cf6..6f7e2e0e1 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -92,7 +92,7 @@ int32_t komodo_gateway_tx(char *symbol,int32_t height,int32_t txi,char *txidstr, { len = (int32_t)strlen(hexstr) >> 1; if ( len != 74 ) - printf("ht.%d txi.%d vout.%d/%d %s script\n",height,txi,vout,n,hexstr); + printf("ht.%d txi.%d vout.%d/%d %s script (%d %d)\n",height,txi,vout,n,hexstr,memcmp(&hexstr[2],CRYPTO777_PUBSECPSTR,66),memcmp(&hexstr[6],CRYPTO777_RMD160STR,40)); if ( vout == 0 && ((memcmp(&hexstr[2],CRYPTO777_PUBSECPSTR,66) == 0 && len == 35) || (memcmp(&hexstr[6],CRYPTO777_RMD160STR,40) == 0 && len == 25)) ) isspecial = 1; else if ( isspecial != 0 && len <= sizeof(script) ) diff --git a/src/komodo_pax.h b/src/komodo_pax.h index 45ac9123d..eaed7d2e6 100644 --- a/src/komodo_pax.h +++ b/src/komodo_pax.h @@ -71,7 +71,7 @@ void pax_rank(uint64_t *ranked,uint32_t *pvals) int32_t dpow_readprices(uint8_t *data,uint32_t *timestampp,double *KMDBTCp,double *BTCUSDp,double *CNYUSDp,uint32_t *pvals) { - uint32_t kmdbtc,btcusd,cnyusd; int32_t i,n,len = 0; + uint32_t kmdbtc,btcusd,cnyusd; int32_t i,n,nonz,len = 0; len += iguana_rwnum(0,&data[len],sizeof(uint32_t),(void *)timestampp); len += iguana_rwnum(0,&data[len],sizeof(uint32_t),(void *)&n); len += iguana_rwnum(0,&data[len],sizeof(uint32_t),(void *)&kmdbtc); // /= 1000 @@ -80,11 +80,15 @@ int32_t dpow_readprices(uint8_t *data,uint32_t *timestampp,double *KMDBTCp,doubl *KMDBTCp = ((double)kmdbtc / (1000000000. * 1000.)); *BTCUSDp = ((double)btcusd / (1000000000. / 1000.)); *CNYUSDp = ((double)cnyusd / 1000000000.); - for (i=0; i 0 ) { - for (i=0; i<32; i++) - printf("%u ",pvals[i]); - printf("t%u n.%d KMD %f BTC %f CNY %f (%f)\n",timestamp,n,KMDBTC,BTCUSD,CNYUSD,CNYUSD!=0?1./CNYUSD:0); - } - if ( timestamp > time(NULL)-600 ) - { - n = komodo_opreturnscript(opret,'P',data+sizeof(crc32),(int32_t)(fsize-sizeof(crc32))); if ( 0 && lastcrc != crc32 ) { - for (i=0; i time(NULL)-600 ) + { + n = komodo_opreturnscript(opret,'P',data+sizeof(crc32),(int32_t)(fsize-sizeof(crc32))); + if ( 0 && lastcrc != crc32 ) + { + for (i=0; i maxsize.%d or data[%d]\n",fsize,maxsize,(int32_t)sizeof(data));