Browse Source

Merge branch 'release/v0.1'

dPoW2
jl777 9 years ago
parent
commit
bdb5bc8188
  1. 2
      iguana/iguana_bundles.c
  2. 29
      iguana/iguana_recv.c

2
iguana/iguana_bundles.c

@ -1546,7 +1546,7 @@ void iguana_bundlestats(struct supernet_info *myinfo,struct iguana_info *coin,ch
fprintf(logfp,"%s bQ.%d %d:%02d:%02d stuck.%d max.%d\n",str,numbQ,(int32_t)difft.x/3600,(int32_t)(difft.x/60)%60,(int32_t)difft.x%60,coin->stucktime!=0?(uint32_t)time(NULL) - coin->stucktime:0,coin->maxstuck);
fflush(logfp);
}
//printf("%s bQ.%d %d:%02d:%02d stuck.%d max.%d\n",str,numbQ,(int32_t)difft.x/3600,(int32_t)(difft.x/60)%60,(int32_t)difft.x%60,coin->stucktime!=0?(uint32_t)time(NULL) - coin->stucktime:0,coin->maxstuck);
printf("%s bQ.%d %d:%02d:%02d stuck.%d max.%d\n",str,numbQ,(int32_t)difft.x/3600,(int32_t)(difft.x/60)%60,(int32_t)difft.x%60,coin->stucktime!=0?(uint32_t)time(NULL) - coin->stucktime:0,coin->maxstuck);
strcpy(coin->lastdispstr,str);
if ( (rand() % 100) == 0 )
myallocated(0,0);

29
iguana/iguana_recv.c

@ -911,10 +911,13 @@ int32_t iguana_gotheadersM(struct iguana_info *coin,struct iguana_peer *addr,str
}
if ( strcmp("BTC",coin->symbol) != 0 && n == 2 )
iguana_sendblockreqPT(coin,addr,0,-1,zblocks[1].RO.hash2,0);
for (i=0; i<coin->bundlescount; i++)
if ( 0 )
{
if ( (bp= coin->bundles[i]) != 0 && bits256_cmp(zblocks[1].RO.hash2,bp->hashes[1]) == 0 && bp->numhashes >= coin->chain->bundlesize )
return(-1);
for (i=0; i<coin->bundlescount; i++)
{
if ( (bp= coin->bundles[i]) != 0 && bits256_cmp(zblocks[1].RO.hash2,bp->hashes[1]) == 0 && bp->numhashes >= coin->chain->bundlesize )
return(-1);
}
}
req = iguana_bundlereq(coin,addr,'H',0,0);
req->blocks = zblocks, req->n = n;
@ -1179,7 +1182,7 @@ struct iguana_bundle *iguana_bundleset(struct supernet_info *myinfo,struct iguan
if ( block != origblock )
{
iguana_blockcopy(coin->chain->zcash,coin->chain->auxpow,coin,block,origblock);
//fprintf(stderr,"bundleset block.%p vs origblock.%p prev.%d bits.%x fpos.%ld\n",block,origblock,bits256_nonz(prevhash2),block->fpipbits,block->fpos);
//fprintf(stderr,"bundleset block.%p vs origblock.%p prev.%d bits.%x fpos.%d\n",block,origblock,bits256_nonz(prevhash2),block->fpipbits,block->fpos);
}
*blockp = block;
if ( coin->blocks.hwmchain.height > 0 && (hwmblock= iguana_blockfind("hwm",coin,coin->blocks.hwmchain.RO.hash2)) != 0 )
@ -1223,7 +1226,6 @@ struct iguana_bundle *iguana_bundleset(struct supernet_info *myinfo,struct iguan
iguana_blockQ("bundleset",coin,bp,bundlei,block->RO.hash2,1);//coin->current == 0 || bp->hdrsi <= coin->current->hdrsi+coin->MAXBUNDLES);
}
//fprintf(stderr,"bundle found %d:%d\n",bp->hdrsi,bundlei);
//printf("bundlehashadd set.%d\n",bundlei);
if ( bundlei > 0 )
{
//printf("bundlehashadd prev %d\n",bundlei);
@ -1310,7 +1312,7 @@ struct iguana_bundlereq *iguana_recvblockhdrs(struct supernet_info *myinfo,struc
if ( zblocks != 0 && n > 0 )
{
memset(prevhash2.bytes,0,sizeof(prevhash2));
for (i=match=0; i<n; i++)
for (i=1,match=0; i<n&&i<coin->chain->bundlesize; i++)
{
//fprintf(stderr,"i.%d of %d bundleset\n",i,n);
if ( bits256_cmp(zblocks[i].RO.prev_block,coin->blocks.hwmchain.RO.hash2) == 0 )
@ -1318,11 +1320,13 @@ struct iguana_bundlereq *iguana_recvblockhdrs(struct supernet_info *myinfo,struc
bp = 0, bundlei = -2;
if ( (bp= iguana_bundleset(myinfo,coin,&block,&bundlei,(struct iguana_block *)&zblocks[i])) != 0 )
{
if ( i == 1 )
firstbp = bp;
if ( block->height >= 0 && block->height+1 > coin->longestchain )
coin->longestchain = block->height+1;
_iguana_chainlink(myinfo,coin,block);
}
//char str[65]; printf("HWM in hdr's prev[%d] bp.%p bundlei.%d block.%p %s\n",i,bp,bundlei,block,bp!=0?bits256_str(str,bp->hashes[bundlei]):"()");
char str[65]; printf("HWM in hdr's prev[%d] bp.%p bundlei.%d block.%p %s\n",i,bp,bundlei,block,bp!=0?bits256_str(str,bp->hashes[bundlei]):"()");
}
if ( i > 0 && bits256_cmp(prevhash2,zblocks[i].RO.prev_block) == 0 )
{
@ -1336,24 +1340,21 @@ struct iguana_bundlereq *iguana_recvblockhdrs(struct supernet_info *myinfo,struc
iguana_blockQ("recvhdr",coin,bp,bundlei,block->RO.hash2,0);
}
//printf("{%d:%d} ",bp->hdrsi,bundlei);
if ( i == 0 )
if ( i == 1 )
{
firstbp = bp;
iguana_checklongestchain(coin,bp,n);
iguana_checklongestchain(coin,bp,coin->chain->bundlesize);
}
if ( bundlei == i+1 && bp == firstbp )
match++;
else
else if ( 0 )
{
if ( 0 && bp != coin->current && i != n-1 )
if ( bp != coin->current && i != coin->chain->bundlesize-1 )
fprintf(stderr,"recvhdr: ht.%d[%d] vs i.%d\n",bp->bundleheight,bundlei,i);
}
}
}
prevhash2 = zblocks[i].RO.hash2;
//printf("%d bp.%p [%d] bundlei.%d %s prev.%s\n",i,bp,bp!=0?bp->hdrsi:-1,bundlei,bits256_str(str,zblocks[i].RO.hash2),bits256_str(str2,zblocks[i].RO.prev_block));
//else if ( bp != firstbp )
// printf("blockhash[%d] cant be found n.%d\n",i,n);
}
char str[65];
if ( 0 && bp == coin->current )

Loading…
Cancel
Save