Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
0443407888
  1. 15
      iguana/iguana_bundles.c
  2. 11
      iguana/iguana_recv.c

15
iguana/iguana_bundles.c

@ -611,13 +611,12 @@ int32_t iguana_bundleready(struct iguana_info *coin,struct iguana_bundle *bp)
printf("checki.%d vs %d mismatch?\n",checki,i);
if ( fname[0] != 0 )
OS_removefile(fname,0);
printf(">>>>>>> block contents error at ht.%d\n",bp->bundleheight+i);
printf(">>>>>>> block contents error at ht.%d (%s)\n",bp->bundleheight+i,fname);
//char str[65]; patch.(%s) and reissue %s checki.%d vs %d\n",block->fpipbits,bp->bundleheight+i,bits256_str(str,block->RO.prev_block),fname,checki,i);
block->fpipbits = 0;
block->fpos = -1;
block->queued = 0;
block->RO.recvlen = 0;
//iguana_blockQ("null retry",coin,bp,i,block->RO.hash2,1);
} else ready++;
} else printf("error getting block (%d:%d) %p\n",bp->hdrsi,i,block);
}
@ -928,8 +927,8 @@ static int32_t revsortds(double *buf,uint32_t num,int32_t size)
void iguana_bundlestats(struct iguana_info *coin,char *str)
{
int32_t i,n,m,j,numv,count,pending,dispflag,numutxo,numbalances,numrecv,done,numhashes,numcached,numsaved,numemit;
int64_t spaceused=0,estsize = 0; struct iguana_bundle *bp,*lastpending = 0,*firstgap = 0; struct iguana_block *block,*prev; uint32_t now;
int32_t i,n,m,j,numv,r,count,pending,dispflag,numutxo,numbalances,numrecv,done,numhashes,numcached,numsaved,numemit;
int64_t spaceused=0,estsize = 0; struct iguana_bundle *bp,*lastpending = 0,*firstgap = 0; struct iguana_block *block,*prev; uint32_t now; struct iguana_peer *addr;
now = (uint32_t)time(NULL);
dispflag = 1;//(rand() % 1000) == 0;
numrecv = numhashes = numcached = numsaved = numemit = done = numutxo = numbalances = 0;
@ -993,11 +992,13 @@ void iguana_bundlestats(struct iguana_info *coin,char *str)
else if ( bp == coin->current )
{
for (j=0; j<bp->n; j++)
if ( (block= bp->blocks[j]) != 0 && block->fpipbits == 0 && time(NULL) > block->issued+10 )
if ( (block= bp->blocks[j]) != 0 && block->fpipbits == 0 && time(NULL) > block->issued+3 )
{
printf("current stop [%d:%d]\n",bp->hdrsi,j);
iguana_blockQ("currentstop",coin,0,-1,block->RO.hash2,1);
if ( (r= coin->peers.numranked) != 0 && (addr= coin->peers.ranked[rand() % r]) != 0 && addr->dead == 0 && addr->usock >= 0 )
iguana_sendblockreqPT(coin,addr,bp,j,block->RO.hash2,0); printf("current stop [%d:%d]\n",bp->hdrsi,j);
iguana_blockQ("currentstop",coin,bp,j,block->RO.hash2,1);
block->issued = (uint32_t)time(NULL);
break;
}
}
//bp->rank = 0;

11
iguana/iguana_recv.c

@ -513,6 +513,7 @@ struct iguana_bundle *iguana_bundleset(struct iguana_info *coin,struct iguana_bl
void iguana_checklongestchain(struct iguana_info *coin,struct iguana_bundle *bp,int32_t num)
{
int32_t i; struct iguana_peer *addr;
if ( num > 10 && num < bp->n && coin->longestchain > bp->bundleheight+num+3 )
{
printf("strange.%d suspicious longestchain.%d vs [%d:%d] %d bp->n %d\n",coin->longestchain_strange,coin->longestchain,bp->hdrsi,num,bp->bundleheight+num,bp->n);
@ -521,6 +522,12 @@ void iguana_checklongestchain(struct iguana_info *coin,struct iguana_bundle *bp,
coin->badlongestchain = coin->longestchain;
coin->longestchain = bp->bundleheight+num;
coin->longestchain_strange = 0;
for (i=0; i<coin->peers.numranked; i++)
if ( (addr= coin->peers.ranked[i]) != 0 && addr->height >= coin->badlongestchain )
{
printf("blacklist addr.(%s) height %d\n",addr->ipaddr,addr->height);
addr->dead = 1;
}
}
}
}
@ -1139,11 +1146,11 @@ int32_t iguana_reqhdrs(struct iguana_info *coin)
if ( (bp= coin->bundles[i]) != 0 && (bp->hdrsi == coin->longestchain/coin->chain->bundlesize || i == coin->bundlescount-1 || bp->numhashes < bp->n) )
{
if ( bp == coin->current )
lag = 3;
lag = 13;
else lag = 30;
if ( time(NULL) > bp->issuetime+lag )
{
if ( bp == coin->current )
if ( 0 && bp == coin->current )
printf("LAG.%ld hdrsi.%d numhashes.%d:%d needhdrs.%d qsize.%d zcount.%d\n",time(NULL)-bp->hdrtime,i,bp->numhashes,bp->n,iguana_needhdrs(coin),queue_size(&coin->hdrsQ),coin->zcount);
if ( bp->issuetime == 0 )
coin->numpendings++;

Loading…
Cancel
Save