|
|
@ -366,7 +366,7 @@ void iguana_bundlepurge(struct iguana_info *coin,struct iguana_bundle *bp) |
|
|
|
|
|
|
|
int32_t iguana_bundleissue(struct iguana_info *coin,struct iguana_bundle *bp,int32_t max,int32_t timelimit) |
|
|
|
{ |
|
|
|
int32_t i,j,k,len,doneval,maxval,numpeers,laggard,finished,peercounts[IGUANA_MAXPEERS],donecounts[IGUANA_MAXPEERS],counter = 0; |
|
|
|
int32_t i,j,k,len,doneval,maxval,numpeers,laggard,flag=0,finished,peercounts[IGUANA_MAXPEERS],donecounts[IGUANA_MAXPEERS],counter = 0; |
|
|
|
struct iguana_peer *addr; uint32_t now; struct iguana_block *block; |
|
|
|
bits256 hashes[50]; uint8_t serialized[sizeof(hashes) + 256]; |
|
|
|
if ( bp == 0 ) |
|
|
@ -455,15 +455,16 @@ int32_t iguana_bundleissue(struct iguana_info *coin,struct iguana_bundle *bp,int |
|
|
|
{ |
|
|
|
for (i=laggard=finished=0; i<numpeers; i++) |
|
|
|
{ |
|
|
|
if ( peercounts[i] > 10 && (addr= coin->peers.ranked[i]) != 0 && now > bp->currenttime+30 ) |
|
|
|
if ( peercounts[i] > 10 && (addr= coin->peers.ranked[i]) != 0 && now > bp->currenttime+10 ) |
|
|
|
{ |
|
|
|
if ( numpeers > 100 || addr->laggard++ > 10 ) |
|
|
|
if ( numpeers > 64 || addr->laggard++ > 3 ) |
|
|
|
addr->dead = (uint32_t)time(NULL); |
|
|
|
for (j=0; j<bp->n; j++) |
|
|
|
{ |
|
|
|
if ( (block= bp->blocks[j]) != 0 && block->peerid == i && block->fpipbits == 0 ) |
|
|
|
{ |
|
|
|
printf("%d ",j); |
|
|
|
flag++; |
|
|
|
block->peerid = 0; |
|
|
|
iguana_blockQ("kick",coin,bp,j,block->RO.hash2,1); |
|
|
|
} |
|
|
@ -476,12 +477,22 @@ int32_t iguana_bundleissue(struct iguana_info *coin,struct iguana_bundle *bp,int |
|
|
|
printf("peercounts, 90%% finished %d, laggards.%d\n",finished,laggard); |
|
|
|
} |
|
|
|
for (i=0; i<bp->n; i++) |
|
|
|
if ( (block= bp->blocks[i]) != 0 && block->fpipbits == 0 && now > block->issued+10 ) |
|
|
|
{ |
|
|
|
if ( (block= bp->blocks[i]) != 0 && block->fpipbits == 0 ) |
|
|
|
{ |
|
|
|
iguana_blockQ("kick",coin,bp,i,block->RO.hash2,1); |
|
|
|
printf("[%d:%d] ",bp->hdrsi,i); |
|
|
|
if ( now > block->issued+10 ) |
|
|
|
{ |
|
|
|
iguana_blockQ("kick",coin,bp,i,block->RO.hash2,0); |
|
|
|
iguana_blockQ("kick",coin,bp,i,block->RO.hash2,1); |
|
|
|
if ( (addr= coin->peers.ranked[rand() % numpeers]) != 0 ) |
|
|
|
iguana_sendblockreqPT(coin,addr,bp,i,block->RO.hash2,0); |
|
|
|
printf("[%d:%d] ",bp->hdrsi,i); |
|
|
|
flag++; |
|
|
|
} else printf("%d ",now - block->issued); |
|
|
|
} |
|
|
|
printf("currentflag.%d ht.%d s.%d finished.%d most.%d laggards.%d maxunfinished.%d\n",bp->currentflag,bp->bundleheight,bp->numsaved,finished,doneval,laggard,maxval); |
|
|
|
} |
|
|
|
if ( flag != 0 ) |
|
|
|
printf("currentflag.%d ht.%d s.%d finished.%d most.%d laggards.%d maxunfinished.%d\n",bp->currentflag,bp->bundleheight,bp->numsaved,finished,doneval,laggard,maxval); |
|
|
|
} |
|
|
|
/*if ( doneval != maxval )
|
|
|
|
{ |
|
|
|