Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
b05bf2efbf
  1. 27
      iguana/iguana_recv.c

27
iguana/iguana_recv.c

@ -415,7 +415,7 @@ void iguana_bundlespeculate(struct iguana_info *coin,struct iguana_bundle *bp,in
int32_t iguana_bundlekick(struct iguana_info *coin,struct iguana_bundle *bp,int32_t starti,int32_t max) int32_t iguana_bundlekick(struct iguana_info *coin,struct iguana_bundle *bp,int32_t starti,int32_t max)
{ {
int32_t i,n,issued,counter = 0; uint32_t now; struct iguana_block *block; int32_t i,n,issued,mini=0,counter = 0; uint32_t now; struct iguana_block *block,*minblock = 0;
if ( bp == 0 ) if ( bp == 0 )
return(0); return(0);
now = (uint32_t)time(NULL); now = (uint32_t)time(NULL);
@ -431,7 +431,6 @@ int32_t iguana_bundlekick(struct iguana_info *coin,struct iguana_bundle *bp,int3
{ {
if ( block->issued == 0 || now > block->issued+60 ) if ( block->issued == 0 || now > block->issued+60 )
{ {
block->numrequests++;
//printf("bundleQ issue %d %x %d [%d:%d] numsaved.%d\n",block->RO.recvlen,block->fpipbits,block->fpos,bp->hdrsi,i,bp->numsaved); //printf("bundleQ issue %d %x %d [%d:%d] numsaved.%d\n",block->RO.recvlen,block->fpipbits,block->fpos,bp->hdrsi,i,bp->numsaved);
/*if ( bp->hdrsi == starti ) /*if ( bp->hdrsi == starti )
{ {
@ -440,19 +439,31 @@ int32_t iguana_bundlekick(struct iguana_info *coin,struct iguana_bundle *bp,int3
iguana_blockQ(coin,bp,i,block->RO.hash2,1); iguana_blockQ(coin,bp,i,block->RO.hash2,1);
} else*/ } else*/
iguana_blockQ("kick",coin,bp,i,block->RO.hash2,0); block->numrequests++;
iguana_blockQ("kick",coin,bp,i,block->RO.hash2,0);
bp->issued[i] = block->issued = now; bp->issued[i] = block->issued = now;
counter++; counter++;
if ( --max <= 0 ) if ( --max <= 0 )
break; break;
} }
else if ( block->fpipbits != 0 && ((bp->hdrsi == 0 && i == 0) || bits256_nonz(block->RO.prev_block) != 0) ) else
n++, issued++; {
else if ( bp->issued[i] != 0 ) if ( minblock == 0 || block->numrequests < minblock->numrequests )
issued++; minblock = block, mini = i;
if ( block->fpipbits != 0 && ((bp->hdrsi == 0 && i == 0) || bits256_nonz(block->RO.prev_block) != 0) )
n++, issued++;
else if ( bp->issued[i] != 0 )
issued++;
}
} else n++, issued++; } else n++, issued++;
} //else printf("iguana_bundleiters[%d] unexpected null block[%d]\n",bp->bundleheight,i); } //else printf("iguana_bundleiters[%d] unexpected null block[%d]\n",bp->bundleheight,i);
} }
if ( minblock != 0 )
{
minblock->numrequests++;
iguana_blockQ("kick",coin,bp,mini,minblock->RO.hash2,0);
bp->issued[i] = minblock->issued = now;
}
return(issued); return(issued);
} }
@ -558,7 +569,7 @@ int32_t iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int
iguana_bundleQ(coin,bp,1000); iguana_bundleQ(coin,bp,1000);
return(0); return(0);
} }
max = sqrt(bp->n) - (bp->n/coin->MAXBUNDLES)*(bp->hdrsi - starti); max = bp->n - (bp->n/coin->MAXBUNDLES)*(bp->hdrsi - starti);
if ( max > 100 ) if ( max > 100 )
max = 100; max = 100;
else if ( max < 10 ) else if ( max < 10 )

Loading…
Cancel
Save