Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
e978674c30
  1. 12
      iguana/iguana_recv.c
  2. 4
      iguana/iguana_unspents.c

12
iguana/iguana_recv.c

@ -200,7 +200,7 @@ struct iguana_txblock *iguana_peertxdata(struct iguana_info *coin,int32_t *bundl
int32_t iguana_speculativefind(struct iguana_info *coin,struct iguana_bundle *bp,struct iguana_block *block,uint8_t *data,int32_t recvlen)
{
int32_t i,j,numcached; uint8_t *tmp; //char str[65];
int32_t i,j,numcached; uint8_t *tmp; char str[65];
for (i=1; i<bp->n; i++)
{
if ( bits256_cmp(bp->speculative[i],block->RO.hash2) == 0 )
@ -209,7 +209,8 @@ int32_t iguana_speculativefind(struct iguana_info *coin,struct iguana_bundle *bp
{
if ( memcmp(&recvlen,tmp,sizeof(recvlen)) != 0 || memcmp(&tmp[sizeof(recvlen)],data,recvlen) != 0 )
printf("ERROR ");
//printf("[%d:%d] already has recvlen.%d for %s\n",bp->hdrsi,i,recvlen,bits256_str(str,block->RO.hash2));
if ( bp == coin->current )
printf("[%d:%d] already has recvlen.%d for %s\n",bp->hdrsi,i,recvlen,bits256_str(str,block->RO.hash2));
return(0);
}
bp->speculativecache[i] = mycalloc('p',1,recvlen + sizeof(recvlen));
@ -218,7 +219,8 @@ int32_t iguana_speculativefind(struct iguana_info *coin,struct iguana_bundle *bp
for (j=numcached=0; j<bp->n; j++)
if ( bp->speculativecache[j] != 0 )
numcached++;
//printf("cache %s [%d:%d] h.%d s.%d c.%d -> %d\n",bits256_str(str,block->RO.hash2),bp->hdrsi,i,bp->numhashes,bp->numsaved,bp->numcached,numcached);
if ( bp == coin->current )
printf("cache %s [%d:%d] h.%d s.%d c.%d -> %d\n",bits256_str(str,block->RO.hash2),bp->hdrsi,i,bp->numhashes,bp->numsaved,bp->numcached,numcached);
return(i);
}
}
@ -660,7 +662,7 @@ struct iguana_bundle *iguana_bundleset(struct iguana_info *coin,struct iguana_bl
}
else if ( bp->hdrsi > 0 && (bp= coin->bundles[bp->hdrsi-1]) != 0 )
iguana_bundlehash2add(coin,0,bp,coin->chain->bundlesize-1,prevhash2);
if ( 0 && coin->enableCACHE != 0 )
if ( 1 && coin->enableCACHE != 0 )
iguana_bundlespeculate(coin,bp,bundlei,hash2,1);
}
prevbp = 0, prevbundlei = -2;
@ -683,7 +685,7 @@ struct iguana_bundle *iguana_bundleset(struct iguana_info *coin,struct iguana_bl
//printf("bundlehash2add next %d\n",prevbundlei);
iguana_bundlehash2add(coin,0,prevbp,prevbundlei+1,hash2);
}
if ( 0 && coin->enableCACHE != 0 )
if ( 1 && coin->enableCACHE != 0 )
iguana_bundlespeculate(coin,prevbp,prevbundlei,prevhash2,2);
}
}

4
iguana/iguana_unspents.c

@ -462,9 +462,9 @@ struct iguana_bundle *iguana_externalspent(struct iguana_info *coin,bits256 *pre
iguana_ramchain_prefetch(coin,&spentbp->ramchain);
spentbp->lastprefetch = (uint32_t)time(NULL);
}
else if ( duration > (3 * coin->txidfind_totalmillis)/coin->txidfind_num && time(NULL) > spentbp->lastprefetch+coin->PREFETCHLAG )
else if ( (duration > 1 || duration > (10 * coin->txidfind_totalmillis)/coin->txidfind_num) && time(NULL) > spentbp->lastprefetch+coin->PREFETCHLAG )
{
printf("slow txidfind %.2f vs %.2f prefetch[%d] from.[%d] lag.%ld\n",duration,coin->txidfind_totalmillis/coin->txidfind_num,spentbp->hdrsi,ramchain->H.data->height/coin->chain->bundlesize,time(NULL) - spentbp->lastprefetch);
printf("slow txidfind %.2f vs %.2f prefetch[%d] from.[%d] lag.%ld last.%u\n",duration,coin->txidfind_totalmillis/coin->txidfind_num,spentbp->hdrsi,ramchain->H.data->height/coin->chain->bundlesize,time(NULL) - spentbp->lastprefetch,spentbp->lastprefetch);
iguana_ramchain_prefetch(coin,&spentbp->ramchain);
spentbp->lastprefetch = (uint32_t)time(NULL);
}

Loading…
Cancel
Save