Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
c6b2decabf
  1. 8
      iguana/iguana_bundles.c
  2. 6
      iguana/iguana_recv.c

8
iguana/iguana_bundles.c

@ -587,7 +587,6 @@ int32_t iguana_bundleissue(struct iguana_info *coin,struct iguana_bundle *bp,int
if ( bp == coin->current ) if ( bp == coin->current )
return(counter); return(counter);
} }
return(counter);
for (i=0; i<bp->n; i++) for (i=0; i<bp->n; i++)
{ {
if ( (block= bp->blocks[i]) != 0 && bp->speculativecache[i] == 0 ) if ( (block= bp->blocks[i]) != 0 && bp->speculativecache[i] == 0 )
@ -663,7 +662,7 @@ int32_t iguana_bundlehdr(struct iguana_info *coin,struct iguana_bundle *bp,int32
{ {
int32_t counter=0; int32_t counter=0;
int32_t i; uint32_t now; struct iguana_block *block; int32_t i; uint32_t now; struct iguana_block *block;
if ( bp->isRT == 0 && (bp->hdrsi == coin->bundlescount-1 || bp == coin->current) ) if ( 0 && 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); 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 && (bp->speculative == 0 || bp->hdrsi >= coin->longestchain/bp->n) ) if ( coin->enableCACHE != 0 && bp->numhashes < bp->n && (bp->speculative == 0 || bp->hdrsi >= coin->longestchain/bp->n) )
{ {
@ -1150,7 +1149,7 @@ void iguana_bundlestats(struct iguana_info *coin,char *str)
} }
continue; continue;
} }
if ( now > bp->issued[j]+3 || (rand() % 10) == 0 ) if ( bp == coin->current && (now > bp->issued[j]+3 || (rand() % 10) == 0) )
{ {
//fprintf(stderr,"-[%d:%d].%d ",bp->hdrsi,j,now-bp->issued[j]); //fprintf(stderr,"-[%d:%d].%d ",bp->hdrsi,j,now-bp->issued[j]);
struct iguana_peer *addr; int32_t r; struct iguana_peer *addr; int32_t r;
@ -1161,7 +1160,8 @@ void iguana_bundlestats(struct iguana_info *coin,char *str)
bp->issued[j] = now; bp->issued[j] = now;
} }
} }
fprintf(stderr,"[%d] check numcached.%d numhashes.%d numsaved.%d havefile.%d missing.%d\n",bp->hdrsi,bp->numcached,bp->numhashes,bp->numsaved,havefile,missing); if ( bp == coin->current )
fprintf(stderr,"[%d] check numcached.%d numhashes.%d numsaved.%d havefile.%d missing.%d\n",bp->hdrsi,bp->numcached,bp->numhashes,bp->numsaved,havefile,missing);
} }
if ( bp->speculative != 0 && missing == 0 ) if ( bp->speculative != 0 && missing == 0 )
{ {

6
iguana/iguana_recv.c

@ -257,7 +257,7 @@ void iguana_gotblockM(struct iguana_info *coin,struct iguana_peer *addr,struct i
{ {
if ( bp->emitfinish != 0 ) if ( bp->emitfinish != 0 )
{ {
printf("got [%d:%d] with emitfinish.%u\n",bp->hdrsi,bundlei,bp->emitfinish); //printf("got [%d:%d] with emitfinish.%u\n",bp->hdrsi,bundlei,bp->emitfinish);
return; return;
} }
bp->dirty++; bp->dirty++;
@ -702,7 +702,7 @@ struct iguana_bundlereq *iguana_recvblockhdrs(struct iguana_info *coin,struct ig
void iguana_autoextend(struct iguana_info *coin,struct iguana_bundle *bp) void iguana_autoextend(struct iguana_info *coin,struct iguana_bundle *bp)
{ {
char hashstr[65],str[65],str2[65]; struct iguana_bundle *newbp; int32_t bundlei; static bits256 zero; char hashstr[65]; struct iguana_bundle *newbp; int32_t bundlei; static bits256 zero;
if ( bp->hdrsi == coin->bundlescount-1 && bits256_nonz(bp->nextbundlehash2) != 0 ) if ( bp->hdrsi == coin->bundlescount-1 && bits256_nonz(bp->nextbundlehash2) != 0 )
{ {
init_hexbytes_noT(hashstr,bp->nextbundlehash2.bytes,sizeof(bits256)); init_hexbytes_noT(hashstr,bp->nextbundlehash2.bytes,sizeof(bits256));
@ -711,7 +711,7 @@ void iguana_autoextend(struct iguana_info *coin,struct iguana_bundle *bp)
{ {
if ( newbp->speculative == 0 ) if ( newbp->speculative == 0 )
queue_enqueue("hdrsQ",&coin->hdrsQ,queueitem(hashstr),1); queue_enqueue("hdrsQ",&coin->hdrsQ,queueitem(hashstr),1);
printf("EXTEND last bundle %s/%s ht.%d\n",bits256_str(str,newbp->hashes[0]),bits256_str(str2,bp->nextbundlehash2),newbp->bundleheight); //printf("EXTEND last bundle %s/%s ht.%d\n",bits256_str(str,newbp->hashes[0]),bits256_str(str2,bp->nextbundlehash2),newbp->bundleheight);
if ( newbp->queued == 0 ) if ( newbp->queued == 0 )
iguana_bundleQ(coin,newbp,1000); iguana_bundleQ(coin,newbp,1000);
} }

Loading…
Cancel
Save