Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
53bdbdb84c
  1. 14
      iguana/iguana_recv.c

14
iguana/iguana_recv.c

@ -67,8 +67,8 @@ int32_t iguana_sendblockreqPT(struct iguana_info *coin,struct iguana_peer *addr,
char hexstr[65]; init_hexbytes_noT(hexstr,hash2.bytes,sizeof(hash2));
if ( addr == 0 || 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);
// if ( (rand() % 10 ) != 0 )
//printf("duplicate req %s or null addr.%p\n",bits256_str(hexstr,hash2),addr);
if ( (rand() % 10 ) != 0 )
return(0);
}
if ( addr->usock < 0 )
@ -78,7 +78,7 @@ int32_t iguana_sendblockreqPT(struct iguana_info *coin,struct iguana_peer *addr,
{
if ( checkbp->emitfinish != 0 || ((block= checkbp->blocks[j]) != 0 && block->mainchain != 0) )
{
printf("found valid [%d:%d] in blockreqPT\n",checkbp->hdrsi,j);
//printf("found valid [%d:%d] in blockreqPT\n",checkbp->hdrsi,j);
return(0);
}
}
@ -86,8 +86,8 @@ int32_t iguana_sendblockreqPT(struct iguana_info *coin,struct iguana_peer *addr,
{
if ( block != 0 && block->hdrsi != 0 && block->bundlei != 0 )
{
printf("found valid [%d:%d] in blockreqPT txvalid.%d\n",block!=0?block->hdrsi:-1,block!=0?block->bundlei:-1,block->txvalid);
if ( block->txvalid != 0 )
//printf("found valid [%d:%d] in blockreqPT txvalid.%d\n",block!=0?block->hdrsi:-1,block!=0?block->bundlei:-1,block->txvalid);
if ( block->mainchain != 0 )
return(0);
}
}
@ -109,7 +109,7 @@ int32_t iguana_sendblockreqPT(struct iguana_info *coin,struct iguana_peer *addr,
bp->issued[bundlei] = addr->pendtime;
if ( block != 0 )
block->issued = addr->pendtime;
//if ( 0 && coin->current == bp )
if ( 0 && coin->current == bp )
printf("REQ.(%s) bundlei.%d hdrsi.%d\n",bits256_str(hexstr,hash2),bundlei,bp!=0?bp->hdrsi:-1);
} else printf("MSG_BLOCK null datalen.%d\n",len);
return(len);
@ -1209,7 +1209,7 @@ int32_t iguana_reqblocks(struct iguana_info *coin)
return(0);
coin->lastreqtime = (uint32_t)time(NULL);
//printf("reqblocks %u\n",coin->lastreqtime);
hdrsi = (coin->blocks.hwmchain.height+1) / coin->chain->bundlesize;
hdrsi = (coin->blocks.hwmchain.height + 1) / coin->chain->bundlesize;
if ( (bp= coin->bundles[hdrsi]) != 0 )
{
for (bundlei=0; bundlei<coin->chain->bundlesize; bundlei++)

Loading…
Cancel
Save