diff --git a/iguana/iguana777.h b/iguana/iguana777.h index f84e0c4eb..bd6e8d4c2 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -23,7 +23,7 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t len); #define IGUANA_MAXSCRIPTSIZE 10001 -#define IGUANA_SERIALIZE_SPENDVECTORGEN +//#define IGUANA_SERIALIZE_SPENDVECTORGEN //#define IGUANA_SERIALIZE_BALANCEGEN //#define IGUANA_DISABLEPEERS #define _IGUANA_MAXSTUCKTIME 3600 @@ -382,7 +382,7 @@ struct iguana_ramchain { struct iguana_ramchain_hdr H; bits256 lasthash2; uint64_t datasize,allocatedA,allocatedU; uint32_t numblocks:31,expanded:1,pkind,externalind,height,numXspends; - long sparsesearches,sparseiters,sparsehits,sparsemax; + long sparseadds,sparsesearches,sparseadditers,sparsesearchiters,sparsehits,sparsemax; struct iguana_kvitem *txids,*pkhashes; struct OS_memspace *hashmem; long filesize,sigsfilesize,debitsfilesize,lastspendsfilesize; void *fileptr,*sigsfileptr,*Xspendptr,*debitsfileptr,*lastspendsfileptr; diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index 5a0db95bb..957dec4db 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -634,7 +634,7 @@ int32_t iguana_bundlehdr(struct iguana_info *coin,struct iguana_bundle *bp,int32 { int32_t counter=0; int32_t i; uint32_t now; struct iguana_block *block; - if ( bp->hdrsi == coin->bundlescount-1 || bp == coin->current ) + if ( bp->isRT == 0 && (bp->hdrsi == coin->bundlescount-1 || bp == coin->current) ) printf("hdr ITERATE.%d bundle.%d vs %d: h.%d n.%d r.%d s.%d c.%d finished.%d spec.%p[%d]\n",bp->hdrsi,bp->bundleheight,coin->longestchain-coin->chain->bundlesize,bp->numhashes,bp->n,bp->numrecv,bp->numsaved,bp->numcached,bp->emitfinish,bp->speculative,bp->numspec); if ( coin->enableCACHE != 0 && bp->numhashes < bp->n ) { diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index b4c7af816..ab377f5df 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -159,6 +159,7 @@ struct iguana_txblock *iguana_peertxdata(struct iguana_info *coin,int32_t *bundl void iguana_gotblockM(struct iguana_info *coin,struct iguana_peer *addr,struct iguana_txblock *origtxdata,struct iguana_msgtx *txarray,struct iguana_msghdr *H,uint8_t *data,int32_t recvlen) { + static uint64_t received[IGUANA_MAXPEERS]; struct iguana_bundlereq *req; struct iguana_txblock *txdata = 0; int32_t valid,i,j,bundlei,copyflag; struct iguana_bundle *bp; if ( 0 ) @@ -186,7 +187,15 @@ void iguana_gotblockM(struct iguana_info *coin,struct iguana_peer *addr,struct i } } } + received[addr->addrind] += recvlen; char str[65]; + if ( (rand() % 1000) == 0 ) + { + uint64_t sum = 0; + for (i=0; iblock,1) < 0 ) { printf("got block that doesnt validate? %s\n",bits256_str(str,origtxdata->block.RO.hash2)); @@ -331,6 +340,16 @@ void iguana_gotheadersM(struct iguana_info *coin,struct iguana_peer *addr,struct struct iguana_bundlereq *req; if ( addr != 0 ) { + static uint32_t hdrsreceived[IGUANA_MAXPEERS]; + hdrsreceived[addr->addrind] += n; + char str[65]; + if ( (rand() % 1000) == 0 ) + { + uint32_t i,sum = 0; + for (i=0; i %s\n",sum,mbstr(str,sum*80)); + } addr->recvhdrs++; if ( addr->pendhdrs > 0 ) addr->pendhdrs--; diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 57acf934e..570d9e5d1 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -185,9 +185,11 @@ uint32_t iguana_sparseadd(uint8_t *bits,uint32_t ind,int32_t width,uint32_t tabl } printf("tableentries.%d\n",n); } - ramchain->sparsesearches++; - if ( (ramchain->sparsesearches % 1000000) == 0 ) - printf("[%3d] %7d.[%-2d %8d] %5.3f sparse searches.%-10ld iters.%-10ld hits.%-10ld %5.2f%% max.%ld\n",ramchain->height/ramchain->H.data->numblocks,ramchain->height,width,tablesize,(double)ramchain->sparseiters/(1+ramchain->sparsesearches),ramchain->sparsesearches,ramchain->sparseiters,ramchain->sparsehits,100.*(double)ramchain->sparsehits/(1+ramchain->sparsesearches),ramchain->sparsemax+1); + if ( setind == 0 ) + ramchain->sparsesearches++; + else ramchain->sparseadds++; + //if ( (ramchain->sparsesearches % 1000000) == 0 ) + printf("[%3d] %7d.[%-2d %8d] %5.3f adds.(%-10ld %10ld) search.(hits.%-10ld %10ld) %5.2f%% max.%ld\n",ramchain->height/ramchain->H.data->numblocks,ramchain->height,width,tablesize,(double)(ramchain->sparseadditers + ramchain->sparsesearchiters)/(1+ramchain->sparsesearches+ramchain->sparseadds),ramchain->sparseadds,ramchain->sparseadditers,ramchain->sparsehits,ramchain->sparsesearches,100.*(double)ramchain->sparsehits/(1+ramchain->sparsesearches),ramchain->sparsemax+1); if ( width == 32 ) { table = (uint32_t *)bits; @@ -197,11 +199,13 @@ uint32_t iguana_sparseadd(uint8_t *bits,uint32_t ind,int32_t width,uint32_t tabl ind = 0; if ( (x= table[ind]) == 0 ) { - if ( (retval= setind) != 0 ) - table[ind] = setind; if ( ++i > ramchain->sparsemax ) ramchain->sparsemax = i; - ramchain->sparseiters += i; + if ( (retval= setind) != 0 ) + { + ramchain->sparseadditers += i; + table[ind] = setind; + } else ramchain->sparsesearchiters += i; return(setind); } else if ( memcmp((void *)(long)((long)refdata + x*refsize),key,keylen) == 0 ) @@ -211,7 +215,7 @@ uint32_t iguana_sparseadd(uint8_t *bits,uint32_t ind,int32_t width,uint32_t tabl ramchain->sparsehits++; if ( ++i > ramchain->sparsemax ) ramchain->sparsemax = i; - ramchain->sparseiters += i; + ramchain->sparseadditers += i; return(x); } } @@ -223,7 +227,6 @@ uint32_t iguana_sparseadd(uint8_t *bits,uint32_t ind,int32_t width,uint32_t tabl printf("tablesize.%d width.%d bitoffset.%d\n",tablesize,width,(int32_t)bitoffset); for (i=0; isparseiters++; if ( ind >= tablesize ) { ind = 0; @@ -254,7 +257,11 @@ uint32_t iguana_sparseadd(uint8_t *bits,uint32_t ind,int32_t width,uint32_t tabl if ( x == 0 ) { if ( (x= setind) == 0 ) + { + ramchain->sparsesearchiters += (i+1); return(0); + } + else ramchain->sparseadditers += (i+1); if ( width == 32 ) memcpy(&bits[bitoffset >> 3],&setind,4); else if ( width == 16 )