Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
353ea4ca76
  1. 4
      iguana/iguana_bundles.c
  2. 8
      iguana/iguana_unspents.c
  3. 30
      iguana/main.c

4
iguana/iguana_bundles.c

@ -839,7 +839,7 @@ int32_t iguana_bundleiters(struct iguana_info *coin,struct OS_memspace *mem,stru
if ( bp->hdrsi == coin->bundlescount-1 )
iguana_autoextend(coin,bp);
//printf("ITER utxo.%u now.%u spec.%-4d bundle.%-4d h.%-4d r.%-4d s.%-4d F.%d T.%d issued.%d mb.%d/%d\n",bp->utxofinish,(uint32_t)time(NULL),bp->numspec,bp->bundleheight/coin->chain->bundlesize,bp->numhashes,bp->numrecv,bp->numsaved,bp->emitfinish,timelimit,counter,coin->MAXBUNDLES,coin->bundlescount);
bp->nexttime = (uint32_t)time(NULL) + cbrt(bp->hdrsi - starti)/10;
bp->nexttime = (uint32_t)time(NULL) + 1;//cbrt(bp->hdrsi - starti)/10;
if ( bp->hdrsi == coin->bundlescount-1 || (bp->numhashes < bp->n && bp->bundleheight < coin->longestchain-coin->chain->bundlesize) )
iguana_bundlehdr(coin,bp,starti);
else if ( bp->emitfinish != 0 )
@ -865,7 +865,7 @@ int32_t iguana_bundleiters(struct iguana_info *coin,struct OS_memspace *mem,stru
}
else if ( bp->numsaved >= bp->n )//&& (bp->isRT == 0 || coin->RTheight > bp->bundleheight+bp->n+coin->minconfirms) )
{
if ( iguana_bundlefinalize(coin,bp,mem,memB) == 0 )
if ( iguana_bundlefinalize(coin,bp,mem,memB) >= 0 )
return(0);
//else bp->nexttime--;
retval = 1;

8
iguana/iguana_unspents.c

@ -167,7 +167,7 @@ int32_t iguana_volatileupdate(struct iguana_info *coin,int32_t incremental,struc
if ( iguana_utxoupdate(coin,spent_hdrsi,spent_unspentind,spent_pkind,spent_value,spendind,fromheight) == 0 )
{
totalmillis += (OS_milliseconds() - startmillis);
if ( (++utxon % 10000) == 0 )
if ( (++utxon % 1000000) == 0 )
printf("ave utxo[%d] %.2f micros total %.2f seconds\n",utxon,(1000. * totalmillis)/utxon,totalmillis/1000.);
return(0);
}
@ -463,7 +463,7 @@ struct iguana_bundle *iguana_externalspent(struct iguana_info *coin,bits256 *pre
duration = (OS_milliseconds() - startmillis);
coin->spendtxid_totalmillis += duration;
coin->spendtxid_num += 1.;
if ( ((uint64_t)coin->spendtxid_num % 1000) == 0 )
if ( ((uint64_t)coin->spendtxid_num % 1000000) == 0 )
printf("spendtxid_num.[%.0f] ave %.2f micros, total %.2f seconds\n",coin->spendtxid_num,(coin->spendtxid_totalmillis*1000.)/coin->spendtxid_num,coin->spendtxid_totalmillis/1000.);
if ( prefetchflag >= 0 && coin->PREFETCHLAG != 0 )
{
@ -489,7 +489,7 @@ struct iguana_bundle *iguana_externalspent(struct iguana_info *coin,bits256 *pre
duration = (OS_milliseconds() - startmillis);
coin->txidfind_totalmillis += duration;
coin->txidfind_num += 1.;
if ( ((uint64_t)coin->txidfind_num % 1000) == 0 )
if ( ((uint64_t)coin->txidfind_num % 1000000) == 0 )
printf("iguana_txidfind.[%.0f] ave %.2f micros, total %.2f seconds\n",coin->txidfind_num,(coin->txidfind_totalmillis*1000.)/coin->txidfind_num,coin->txidfind_totalmillis/1000.);
if ( prefetchflag >= 0 && coin->PREFETCHLAG != 0 )
{
@ -871,7 +871,7 @@ int32_t iguana_spendvectors(struct iguana_info *coin,struct iguana_bundle *bp,st
if ( (spentbp= iguana_externalspent(coin,&prevhash,&spent_unspentind,bp,ramchain,bp->hdrsi,s,convertflag != 0 ? 2 : -1)) != 0 && spentbp->ramchain.H.data != 0 )
{
totalmillis += (OS_milliseconds() - startmillis);
if ( (++num % 100000) == 0 )
if ( (++num % 1000000) == 0 )
printf("externalspents.[%d] ave %.2f micros, total %.2f seconds\n",num,(totalmillis*1000.)/num,totalmillis/1000.);
if ( spentbp == bp )
{

30
iguana/main.c

@ -346,7 +346,7 @@ mksquashfs DB/BTC BTC.squash1M -b 1048576
void mainloop(struct supernet_info *myinfo)
{
int32_t i,n,iter,flag,isRT,numpeers; struct iguana_info *coin; struct iguana_helper *ptr; struct iguana_bundle *bp;
int32_t i,j,n,iter,flag,isRT,numpeers; struct iguana_info *coin; struct iguana_helper *ptr; struct iguana_bundle *bp;
sleep(3);
printf("mainloop\n");
while ( 1 )
@ -365,6 +365,34 @@ void mainloop(struct supernet_info *myinfo)
{
isRT *= coin->isRT;
numpeers += coin->peers.numranked;
if ( (bp= coin->current) != 0 && bp->hdrsi == coin->longestchain/coin->chain->bundlesize )
{
n = bp->hdrsi;
for (j=0; j<n; j++)
{
if ( (bp= coin->bundles[j]) == 0 || bp->emitfinish <= 1 )
break;
}
if ( j == n )
{
for (j=0; j<n; j++)
{
if ( (bp= coin->bundles[j]) == 0 || bp->utxofinish <= 1 )
break;
}
if ( j != n )
{
for (j=0; j<n; j++)
{
if ( (bp= coin->bundles[j]) != 0 )
{
bp->balancefinish = bp->startutxo = bp->utxofinish = 0;
iguana_bundleQ(coin,bp,1000);
}
}
}
}
}
n = queue_size(&balancesQ);
for (iter=0; iter<n; iter++)
{

Loading…
Cancel
Save