Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
f8095f8972
  1. 4
      iguana/iguana_msg.c
  2. 6
      iguana/iguana_unspents.c

4
iguana/iguana_msg.c

@ -170,14 +170,14 @@ void iguana_gotversion(struct iguana_info *coin,struct iguana_peer *addr,struct
addr->dead = (uint32_t)time(NULL); addr->dead = (uint32_t)time(NULL);
if ( (vers->nServices & (1<<7)) == (1<<7) ) if ( (vers->nServices & (1<<7)) == (1<<7) )
addr->supernet = 1; addr->supernet = 1;
printf("nServices.%lld nonce.%llu %srelay node.(%s) supernet.%d\n",(long long)vers->nServices,(long long)vers->nonce,addr->relayflag==0?"non-":"",addr->ipaddr,addr->supernet); printf("height.%d nServices.%lld nonce.%llu %srelay node.(%s) supernet.%d\n",vers->nStartingHeight,(long long)vers->nServices,(long long)vers->nonce,addr->relayflag==0?"non-":"",addr->ipaddr,addr->supernet);
if ( vers->nStartingHeight > coin->longestchain ) if ( vers->nStartingHeight > coin->longestchain )
{ {
if ( coin->badlongestchain != 0 && vers->nStartingHeight >= coin->badlongestchain ) if ( coin->badlongestchain != 0 && vers->nStartingHeight >= coin->badlongestchain )
{ {
printf("peer.(%s) gives badlongestchain.%d\n",addr->ipaddr,vers->nStartingHeight); printf("peer.(%s) gives badlongestchain.%d\n",addr->ipaddr,vers->nStartingHeight);
addr->dead = 1; addr->dead = 1;
} else coin->longestchain = (vers->nStartingHeight + coin->longestchain + 1) >> 1; } else coin->longestchain = vers->nStartingHeight;
} }
iguana_queue_send(coin,addr,0,serialized,"getaddr",0,0,0); iguana_queue_send(coin,addr,0,serialized,"getaddr",0,0,0);
} }

6
iguana/iguana_unspents.c

@ -190,8 +190,8 @@ uint32_t iguana_sparseadd(uint8_t *bits,uint32_t ind,int32_t width,uint32_t tabl
sparsesearches++; sparsesearches++;
if ( 0 && setind == 0 ) if ( 0 && setind == 0 )
printf("tablesize.%d width.%d bitoffset.%d\n",tablesize,width,(int32_t)bitoffset); printf("tablesize.%d width.%d bitoffset.%d\n",tablesize,width,(int32_t)bitoffset);
if ( (sparsesearches % 10000) == 0 ) //if ( (sparsesearches % 100000) == 0 )
printf("[%d %d] %.3f sparse searches.%ld iters.%ld hits.%ld max.%ld\n",width,tablesize,(double)sparseiters/(1+sparsesearches),sparsesearches,sparseiters,sparsehits,sparsemax+1); printf("[%d %d] %.3f sparse searches.%ld iters.%ld hits.%ld %.2f%% max.%ld\n",width,tablesize,(double)sparseiters/(1+sparsesearches),sparsesearches,sparseiters,sparsehits,100.*(double)sparsehits/(1+sparsesearches),sparsemax+1);
for (i=0; i<tablesize; i++,ind++,bitoffset+=width) for (i=0; i<tablesize; i++,ind++,bitoffset+=width)
{ {
sparseiters++; sparseiters++;
@ -246,6 +246,8 @@ uint32_t iguana_sparseadd(uint8_t *bits,uint32_t ind,int32_t width,uint32_t tabl
sparsehits++; sparsehits++;
else if ( setind != x ) else if ( setind != x )
printf("sparseadd index collision setind.%d != x.%d refsize.%d keylen.%d\n",setind,x,refsize,keylen); printf("sparseadd index collision setind.%d != x.%d refsize.%d keylen.%d\n",setind,x,refsize,keylen);
if ( i > sparsemax )
sparsemax = i;
return(x); return(x);
} }
} }

Loading…
Cancel
Save