Browse Source

test

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

18
iguana/iguana_bundles.c

@ -667,7 +667,7 @@ int32_t iguana_bundlehdr(struct iguana_info *coin,struct iguana_bundle *bp,int32
bp->hdrtime = (uint32_t)time(NULL); bp->hdrtime = (uint32_t)time(NULL);
if ( bp == coin->current && bp->speculative != 0 ) if ( bp == coin->current && bp->speculative != 0 )
{ {
//printf("iguana_bundlehdr.[%d] %d %s\n",bp->hdrsi,bp->numspec,bits256_str(str,bp->hashes[0])); printf("iguana_bundlehdr.[%d] %d %s\n",bp->hdrsi,bp->numspec,bits256_str(str,bp->hashes[0]));
//if ( iguana_blocksmissing(coin,&avail,missings,0,bp,0,7) > 0 ) //if ( iguana_blocksmissing(coin,&avail,missings,0,bp,0,7) > 0 )
// iguana_bundleissuemissing(coin,bp,missings,3); // iguana_bundleissuemissing(coin,bp,missings,3);
} }
@ -699,11 +699,21 @@ int32_t iguana_setmaxbundles(struct iguana_info *coin)
int32_t iguana_bundletweak(struct iguana_info *coin,struct iguana_bundle *bp) int32_t iguana_bundletweak(struct iguana_info *coin,struct iguana_bundle *bp)
{ {
struct iguana_bundle *lastbp; struct iguana_bundle *lastbp; int32_t i,pending;
if ( coin->current == bp ) if ( coin->current == bp )
coin->current = coin->bundles[bp->hdrsi+1]; coin->current = coin->bundles[bp->hdrsi+1];
if ( (lastbp= coin->lastpending) != 0 && lastbp->hdrsi < coin->bundlescount-1 ) if ( (lastbp= coin->current) != 0 )
coin->lastpending = coin->bundles[lastbp->hdrsi + 1]; {
for (pending=0,i=lastbp->hdrsi+1; i<coin->bundlescount; i++)
{
if ( (lastbp= coin->bundles[i]) != 0 && lastbp->emitfinish == 0 )
{
if ( ++pending == coin->MAXBUNDLES )
break;
}
}
coin->lastpending = lastbp;
}
iguana_setmaxbundles(coin); iguana_setmaxbundles(coin);
return(coin->MAXBUNDLES); return(coin->MAXBUNDLES);
} }

8
iguana/iguana_recv.c

@ -792,7 +792,7 @@ struct iguana_bundlereq *iguana_recvblockhashes(struct iguana_info *coin,struct
memset(zero.bytes,0,sizeof(zero)); memset(zero.bytes,0,sizeof(zero));
bp = 0, bundlei = -2; bp = 0, bundlei = -2;
iguana_bundlefind(coin,&bp,&bundlei,blockhashes[1]); iguana_bundlefind(coin,&bp,&bundlei,blockhashes[1]);
if ( 0 && num >= coin->chain->bundlesize ) if ( 1 && num >= coin->chain->bundlesize )
printf("blockhashes[%d] %d of %d %s bp.%d[%d]\n",num,bp==0?-1:bp->hdrsi,coin->bundlescount,bits256_str(str,blockhashes[1]),bp==0?-1:bp->bundleheight,bundlei); printf("blockhashes[%d] %d of %d %s bp.%d[%d]\n",num,bp==0?-1:bp->hdrsi,coin->bundlescount,bits256_str(str,blockhashes[1]),bp==0?-1:bp->bundleheight,bundlei);
if ( num < 2 ) if ( num < 2 )
return(req); return(req);
@ -826,11 +826,11 @@ struct iguana_bundlereq *iguana_recvblockhashes(struct iguana_info *coin,struct
for (i=bp->numspec; i<num&&i<=bp->n; i++) for (i=bp->numspec; i<num&&i<=bp->n; i++)
{ {
bp->speculative[i] = blockhashes[i]; bp->speculative[i] = blockhashes[i];
if ( bp->blocks[i] == 0 || bp->blocks[i]->issued == 0 )
iguana_blockQ("speculate",coin,bp,-i,blockhashes[i],0);
if ( bp->blocks[i] == 0 ) if ( bp->blocks[i] == 0 )
bp->blocks[i] = iguana_blockhashset("recvhashes3",coin,bp->bundleheight+i,blockhashes[i],1); bp->blocks[i] = iguana_blockhashset("recvhashes3",coin,bp->bundleheight+i,blockhashes[i],1);
//printf("speculate new issue [%d:%d]\n",bp->hdrsi,i); //printf("speculate new issue [%d:%d]\n",bp->hdrsi,i);
if ( 0 && bp->blocks[i] == 0 )
iguana_blockQ("speculate",coin,bp,-i,blockhashes[i],0);
} }
bp->speculative[0] = bp->hashes[0]; bp->speculative[0] = bp->hashes[0];
bp->numspec = num <= bp->n+1 ? num : bp->n+1; bp->numspec = num <= bp->n+1 ? num : bp->n+1;
@ -931,7 +931,7 @@ struct iguana_bundlereq *iguana_recvblock(struct iguana_info *coin,struct iguana
} }
} }
} }
if ( 0 )//&& bp != 0 && bp->hdrsi == coin->bundlescount-1 ) if ( 1 )//&& bp != 0 && bp->hdrsi == coin->bundlescount-1 )
{ {
int32_t i; static int32_t numrecv; int32_t i; static int32_t numrecv;
numrecv++; numrecv++;

Loading…
Cancel
Save