Browse Source

test

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

16
iguana/iguana_bundles.c

@ -662,17 +662,23 @@ int64_t iguana_bundlecalcs(struct iguana_info *coin,struct iguana_bundle *bp)
printf("iguana_bundlecalcs.(%s) illegal hdrsi.%d bundlei.%d checki.%d\n",fname,hdrsi,bundlei,checki);
continue;
}
if ( coin->current == bp && (fp= fopen(fname,"rb")) != 0 )
if ( coin->current == bp )
{
fseek(fp,0,SEEK_END);
if ( block->RO.recvlen == 0 )
if ( (fp= fopen(fname,"rb")) != 0 )
{
fseek(fp,0,SEEK_END);
block->RO.recvlen = (uint32_t)ftell(fp);
block->fpipbits = 1;
block->fpos = 0;
//printf("[%d:%d] len.%d\n",hdrsi,bundlei,block->RO.recvlen);
//printf("fp.[%d:%d] len.%d\n",hdrsi,bundlei,block->RO.recvlen);
fclose(fp);
}
else
{
block->RO.recvlen = 0;
block->fpipbits = 0;
block->fpos = 0;
}
fclose(fp);
}
//bp->blocks[bundlei] = block;
block->hdrsi = bp->hdrsi, block->bundlei = bundlei;

8
iguana/iguana_recv.c

@ -53,7 +53,7 @@ int32_t iguana_sendblockreqPT(struct iguana_info *coin,struct iguana_peer *addr,
coin->numreqsent++;
addr->pendblocks++;
addr->pendtime = (uint32_t)time(NULL);
//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);
@ -256,7 +256,7 @@ void iguana_gotblockM(struct iguana_info *coin,struct iguana_peer *addr,struct i
}
}
req->block = txdata->block;
printf("recvlen.%d ipbits.%x prev.(%s)\n",req->block.RO.recvlen,req->block.fpipbits,bits256_str(str,txdata->block.RO.prev_block));
//printf("recvlen.%d ipbits.%x prev.(%s)\n",req->block.RO.recvlen,req->block.fpipbits,bits256_str(str,txdata->block.RO.prev_block));
req->block.RO.txn_count = req->numtx = txdata->block.RO.txn_count;
coin->recvcount++;
coin->recvtime = (uint32_t)time(NULL);
@ -982,7 +982,7 @@ int32_t iguana_reqblocks(struct iguana_info *coin)
else if ( bp != 0 && time(NULL) > bp->hdrtime+10 )
{
char str[65];
printf("MAINCHAIN gethdr %d %s\n",bp->bundleheight,bits256_str(str,bp->hashes[0]));
//printf("MAINCHAIN gethdr %d %s\n",bp->bundleheight,bits256_str(str,bp->hashes[0]));
queue_enqueue("hdrsQ",&coin->hdrsQ,queueitem(bits256_str(str,bp->hashes[0])),1);
bp->hdrtime = (uint32_t)time(NULL);
}
@ -1185,7 +1185,7 @@ int32_t iguana_pollQsPT(struct iguana_info *coin,struct iguana_peer *addr)
}
if ( bp == 0 || z != 0 )
{
printf("%s request HDR.(%s) numhashes.%d\n",addr!=0?addr->ipaddr:"local",hashstr,bp!=0?bp->numhashes:0);
//printf("%s request HDR.(%s) numhashes.%d\n",addr!=0?addr->ipaddr:"local",hashstr,bp!=0?bp->numhashes:0);
iguana_send(coin,addr,serialized,datalen);
addr->pendhdrs++;
flag++;

Loading…
Cancel
Save