Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
a4de2cf944
  1. 8
      iguana/iguana_realtime.c
  2. 13
      iguana/iguana_recv.c
  3. 2
      iguana/iguana_unspents.c

8
iguana/iguana_realtime.c

@ -509,12 +509,12 @@ void iguana_RTunmap(uint8_t *ptr,uint32_t len)
void *iguana_RTrawdata(struct iguana_info *coin,bits256 hash2,uint8_t *data,int32_t *recvlenp,int32_t *numtxp)
{
FILE *fp; char fname[1024],str[65]; long filesize; uint8_t *ptr; uint32_t i,nonz,checknumtx,checklen;
if ( coin->RTheight == 0 )
return(0);
sprintf(fname,"%s/%s/RT/%s.raw",GLOBAL_TMPDIR,coin->symbol,bits256_str(str,hash2));
OS_compatible_path(fname);
if ( *recvlenp > 0 )
{
if ( coin->RTheight == 0 )
return(0);
if ( (fp= fopen(fname,"wb")) != 0 )
{
if ( fwrite(recvlenp,1,sizeof(*recvlenp),fp) != sizeof(*recvlenp) || fwrite(numtxp,1,sizeof(*numtxp),fp) != sizeof(*numtxp) || fwrite(data,1,*recvlenp,fp) != *recvlenp )
@ -563,12 +563,14 @@ void iguana_RTpurge(struct iguana_info *coin,int32_t lastheight)
int32_t iguana_RTiterate(struct iguana_info *coin,int32_t offset,struct iguana_block *block,int64_t polarity)
{
struct iguana_txblock txdata; uint8_t *serialized; int32_t n,errs=0,numtx,len; uint32_t recvlen = 0;
struct iguana_txblock txdata; struct iguana_peer *addr; uint8_t *serialized; int32_t n,errs=0,numtx,len; uint32_t recvlen = 0;
while ( (numtx= coin->RTnumtx[offset]) == 0 || (serialized= coin->RTrawdata[offset]) == 0 || (recvlen= coin->RTrecvlens[offset]) == 0 )
{
char str[65];
printf("errs.%d cant load %s ht.%d polarity.%lld numtx.%d %p recvlen.%d\n",errs,bits256_str(str,block->RO.hash2),block->height,(long long)polarity,coin->RTnumtx[offset],coin->RTrawdata[offset],coin->RTrecvlens[offset]);
iguana_blockQ("RTiterate",coin,0,-1,block->RO.hash2,1);
if ( coin->peers != 0 && coin->peers->numranked > 0 && (addr= coin->peers->ranked[rand() % coin->peers->numranked]) != 0 )
iguana_sendblockreqPT(coin,addr,0,-1,block->RO.hash2,1);
sleep(3);
if ( errs++ > 10 )
{

13
iguana/iguana_recv.c

@ -63,12 +63,12 @@ int32_t iguana_speculativesearch(struct iguana_info *coin,struct iguana_block **
int32_t iguana_sendblockreqPT(struct iguana_info *coin,struct iguana_peer *addr,struct iguana_bundle *bp,int32_t bundlei,bits256 hash2,int32_t iamthreadsafe)
{
static bits256 lastreq,lastreq2;
int32_t len,j; struct iguana_bundle *checkbp; uint8_t serialized[sizeof(struct iguana_msghdr) + sizeof(uint32_t)*32 + sizeof(bits256)]; struct iguana_block *block=0;
int32_t len,j,recvlen,numtx; struct iguana_bundle *checkbp; uint8_t serialized[sizeof(struct iguana_msghdr) + sizeof(uint32_t)*32 + sizeof(bits256)]; struct iguana_block *block=0;
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 )
if ( iamthreadsafe == 0 && (rand() % 10 ) != 0 )
return(0);
}
if ( addr->usock < 0 )
@ -78,8 +78,13 @@ int32_t iguana_sendblockreqPT(struct iguana_info *coin,struct iguana_peer *addr,
{
if ( checkbp->emitfinish != 0 || ((block= checkbp->blocks[j]) != 0 && block->txvalid != 0 && block->mainchain != 0 && block->valid != 0) )
{
//printf("found valid [%d:%d] in blockreqPT\n",checkbp->hdrsi,j);
return(0);
char str[65];
recvlen = numtx = 0;
if ( iguana_RTrawdata(coin,hash2,0,&recvlen,&numtx) != 0 )
{
printf("found valid [%d:%d] in blockreqPT\n",checkbp->hdrsi,j);
return(0);
} else printf("no RTrawdata for %s\n",bits256_str(str,hash2));
}
}
if ( 0 && coin->enableCACHE != 0 && iguana_speculativesearch(coin,&block,hash2) != 0 )

2
iguana/iguana_unspents.c

@ -1122,7 +1122,7 @@ int32_t iguana_utxoaddr_check(struct supernet_info *myinfo,struct iguana_info *c
}
good++;
if ( ((good + bad) % 1000) == 0 )
printf("%s utxoaddr validate good.%d bad.%d%s\n",coin->symbol,good,bad,strcmp(coin->symbol,"BTC") == 0 ? " | (if this is taking too long, just exit and restart iguana)" : "");
printf("%s total %d utxoaddr validate good.%d bad.%d%s\n",coin->symbol,coin->utxoaddrind,good,bad,strcmp(coin->symbol,"BTC") == 0 ? " | (if this is taking too long, just exit and restart iguana)" : "");
return(0);
}

Loading…
Cancel
Save