From 1c73b724d1935ec2007d42ae758778e8a05515f9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 18 Sep 2016 08:07:18 -0300 Subject: [PATCH] test --- iguana/iguana_bundles.c | 20 +++++++++----------- iguana/iguana_recv.c | 6 +++--- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index 93805fd1e..43a6b3a99 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -615,7 +615,7 @@ struct iguana_block *iguana_bundleblock(struct iguana_info *coin,bits256 *hash2p int32_t iguana_bundleissuemissing(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_bundle *bp,int32_t priority,double mult) { - int32_t i,max,nonz,starti,lasti,firsti,lag,num,n=0; uint32_t now; bits256 hash2; double aveduration; struct iguana_peer *addr; char str[65]; //struct iguana_block *block; + int32_t i,max,nonz,starti,lasti,firsti,lag,num,n=0; uint32_t now; bits256 hash2; double aveduration; struct iguana_peer *addr; char str[65]; struct iguana_block *block; if ( coin->peers == 0 ) { printf("%s has no peers\n",coin->symbol); @@ -625,7 +625,7 @@ int32_t iguana_bundleissuemissing(struct supernet_info *myinfo,struct iguana_inf lasti = coin->lastpending == 0 ? coin->bundlescount-1 : coin->lastpending->hdrsi; if ( bp->hdrsi < starti || bp->hdrsi > lasti || bp->emitfinish != 0 )//|| ((priority > 0 || bp == coin->current) && time(NULL) < bp->missingstime+3) ) { - printf("bp->hdrsi %d < %d starti || bp->hdrsi %d > %d lasti || bp->emitfinish %d != 0\n",bp->hdrsi,starti,bp->hdrsi,lasti,bp->emitfinish); + //printf("bp->hdrsi %d < %d starti || bp->hdrsi %d > %d lasti || bp->emitfinish %d != 0\n",bp->hdrsi,starti,bp->hdrsi,lasti,bp->emitfinish); return(0); } bp->missingstime = (uint32_t)time(NULL); @@ -657,10 +657,10 @@ int32_t iguana_bundleissuemissing(struct supernet_info *myinfo,struct iguana_inf lasti = firsti = -1; for (i=nonz=0; in; i++) { - //if ( (block= bp->blocks[i]) != 0 && block->txvalid != 0 && block->mainchain != 0 ) - // continue; - if ( GETBIT(bp->haveblock,i) != 0 ) + if ( (block= bp->blocks[i]) != 0 && block->txvalid != 0 && block->mainchain != 0 ) continue; + //if ( GETBIT(bp->haveblock,i) != 0 ) + // continue; nonz++; if ( firsti < 0 ) firsti = i; @@ -672,8 +672,6 @@ int32_t iguana_bundleissuemissing(struct supernet_info *myinfo,struct iguana_inf { if ( (addr= coin->peers->ranked[rand() % max]) != 0 && addr->usock >= 0 && addr->dead == 0 ) //strcmp("BTC",coin->symbol) != 0 || (bp->issued[i] > 1 && now > bp->issued[i]+lag && { - if ( bp == coin->current ) - printf("reqPT "); iguana_sendblockreqPT(coin,0,bp,i,hash2,0); } struct iguana_blockreq *req = 0; @@ -685,14 +683,14 @@ int32_t iguana_bundleissuemissing(struct supernet_info *myinfo,struct iguana_inf queue_enqueue("missing",&coin->priorityQ,&req->DL,0); bp->issued[i] = 1; n++; - if ( bp == coin->current ) + if ( 0 && bp == coin->current ) printf("%s issuemissing.[%d:%d]\n",bits256_str(str,hash2),bp->hdrsi,i); } //else printf("[z%d] ",i); } //else printf("%d ",now - (bp->issued[i]+lag)); } if ( firsti >= 0 )//&& bp == coin->current ) { - if ( bp == coin->current ) + if ( 0 && bp == coin->current ) printf("%s [%d] first missing.%d of %d\n",bits256_str(str,hash2),bp->hdrsi,firsti,nonz); iguana_bundleblock(coin,&hash2,bp,firsti); if ( bits256_nonz(hash2) != 0 ) @@ -705,7 +703,7 @@ int32_t iguana_bundleissuemissing(struct supernet_info *myinfo,struct iguana_inf //printf("send reqPT [%d:%d]\n",bp->hdrsi,firsti); iguana_sendblockreqPT(coin,0,bp,firsti,hash2,0); } - } else printf("no hash for [%d:%d]\n",bp->hdrsi,firsti); + } // else printf("no hash for [%d:%d]\n",bp->hdrsi,firsti); } } //if ( n > 0 || bp == coin->current ) @@ -1440,7 +1438,7 @@ void iguana_bundlestats(struct supernet_info *myinfo,struct iguana_info *coin,ch if ( GETBIT(bp->haveblock,i) == 0 ) bp->issued[i] = 0, j++; n = iguana_bundleissuemissing(myinfo,coin,bp,3,1.); - printf("issued 1st.[%d] %d of %d\n",bp->hdrsi,n,j); + //printf("issued 1st.[%d] %d of %d\n",bp->hdrsi,n,j); } if ( (coin->current= firstgap) == 0 ) { diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index 88face990..72befb92b 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -73,7 +73,7 @@ int32_t iguana_sendblockreqPT(struct iguana_info *coin,struct iguana_peer *addr, return(0); if ( memcmp(lastreq.bytes,hash2.bytes,sizeof(hash2)) == 0 || memcmp(lastreq2.bytes,hash2.bytes,sizeof(hash2)) == 0 ) { - printf("duplicate req %s or null addr.%p\n",bits256_str(hexstr,hash2),addr); + //printf("duplicate req %s or null addr.%p\n",bits256_str(hexstr,hash2),addr); if ( iamthreadsafe == 0 && (rand() % 10) != 0 ) return(0); } @@ -119,7 +119,7 @@ int32_t iguana_sendblockreqPT(struct iguana_info *coin,struct iguana_peer *addr, { if ( coin->RTheight == 0 && bp != coin->current && bp->issued[bundlei] > 1 && addr->pendtime < bp->issued[bundlei]+7 ) { - printf("SKIP.(%s) [%d:%d] %s n.%d\n",bits256_str(hexstr,hash2),bundlei,bp!=0?bp->hdrsi:-1,addr->ipaddr,addr->pendblocks); + //printf("SKIP.(%s) [%d:%d] %s n.%d\n",bits256_str(hexstr,hash2),bundlei,bp!=0?bp->hdrsi:-1,addr->ipaddr,addr->pendblocks); return(0); } bp->issued[bundlei] = addr->pendtime; @@ -127,7 +127,7 @@ int32_t iguana_sendblockreqPT(struct iguana_info *coin,struct iguana_peer *addr, iguana_send(coin,addr,serialized,len); if ( block != 0 ) block->issued = addr->pendtime; - //if ( coin->current == bp ) + if ( coin->current == bp ) printf("REQ.(%s) [%d:%d] %s n.%d\n",bits256_str(hexstr,hash2),bundlei,bp!=0?bp->hdrsi:-1,addr->ipaddr,addr->pendblocks); } else printf("MSG_BLOCK null datalen.%d\n",len); return(len);