Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
3e0660be19
  1. 17
      iguana/iguana_realtime.c
  2. 1
      iguana/iguana_volatiles.c
  3. 2
      includes/iguana_structs.h

17
iguana/iguana_realtime.c

@ -23,8 +23,9 @@ void iguana_RTramchainfree(struct iguana_info *coin,struct iguana_bundle *bp)
{ {
printf("free RTramchain\n"); printf("free RTramchain\n");
iguana_utxoupdate(coin,-1,0,0,0,0,-1,0); // free hashtables iguana_utxoupdate(coin,-1,0,0,0,0,-1,0); // free hashtables
coin->RTheight = 0;//(coin->bundlescount-1) * coin->chain->bundlesize; coin->lastRTheight = coin->RTheight = (coin->bundlescount-1) * coin->chain->bundlesize;
coin->RTgenesis = 0; coin->RTgenesis = 0;
iguana_utxoaddrs_purge(coin);
iguana_ramchain_free(coin,&coin->RTramchain,1); iguana_ramchain_free(coin,&coin->RTramchain,1);
if ( bp != 0 ) if ( bp != 0 )
bp->ramchain = coin->RTramchain; bp->ramchain = coin->RTramchain;
@ -73,7 +74,7 @@ void iguana_RTramchainalloc(char *fname,struct iguana_info *coin,struct iguana_b
if ( (rdata= dest->H.data) != 0 ) if ( (rdata= dest->H.data) != 0 )
{ {
i = 0; i = 0;
if ( coin->RTheight != bp->bundleheight + rdata->numblocks ) if ( coin->RTheight != coin->lastRTheight )
changed++; changed++;
else else
{ {
@ -217,7 +218,8 @@ int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info *
if ( coin->RTheight >= (coin->current->hdrsi+1)*coin->chain->bundlesize ) if ( coin->RTheight >= (coin->current->hdrsi+1)*coin->chain->bundlesize )
{ {
printf("inversion RT %d >= %d\n",coin->RTheight,(coin->current->hdrsi+1)*coin->chain->bundlesize); printf("inversion RT %d >= %d\n",coin->RTheight,(coin->current->hdrsi+1)*coin->chain->bundlesize);
coin->RTheight = coin->current->hdrsi*coin->chain->bundlesize; coin->lastRTheight = coin->RTheight = coin->current->hdrsi*coin->chain->bundlesize;
iguana_utxoaddrs_purge(coin);
} }
if ( coin->current != 0 && (coin->blocks.hwmchain.height % coin->chain->bundlesize) == coin->chain->bundlesize-1 && coin->blocks.hwmchain.height/coin->chain->bundlesize == coin->longestchain/coin->chain->bundlesize ) if ( coin->current != 0 && (coin->blocks.hwmchain.height % coin->chain->bundlesize) == coin->chain->bundlesize-1 && coin->blocks.hwmchain.height/coin->chain->bundlesize == coin->longestchain/coin->chain->bundlesize )
{ {
@ -266,7 +268,8 @@ int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info *
printf("RT mismatch %d != %d\n",coin->bundlescount-1,coin->balanceswritten); printf("RT mismatch %d != %d\n",coin->bundlescount-1,coin->balanceswritten);
iguana_RTramchainfree(coin,coin->current); iguana_RTramchainfree(coin,coin->current);
coin->spendvectorsaved = 0; coin->spendvectorsaved = 0;
coin->RTheight = 0; coin->lastRTheight = coin->RTheight = 0;
iguana_utxoaddrs_purge(coin);
/*while ( coin->spendvectorsaved <= 1 ) /*while ( coin->spendvectorsaved <= 1 )
{ {
fprintf(stderr,"wait for spendvectorsaved\n"); fprintf(stderr,"wait for spendvectorsaved\n");
@ -277,7 +280,10 @@ int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info *
if ( coin->RTdatabad == 0 && bp->hdrsi >= (coin->longestchain/coin->chain->bundlesize)-1 && bp->hdrsi >= coin->balanceswritten-2 && ((coin->RTheight < coin->blocks.hwmchain.height-offset && time(NULL) > bp->lastRT) || time(NULL) > bp->lastRT+1) ) //coin->RTheight >= bp->bundleheight && coin->RTheight < bp->bundleheight+bp->n && if ( coin->RTdatabad == 0 && bp->hdrsi >= (coin->longestchain/coin->chain->bundlesize)-1 && bp->hdrsi >= coin->balanceswritten-2 && ((coin->RTheight < coin->blocks.hwmchain.height-offset && time(NULL) > bp->lastRT) || time(NULL) > bp->lastRT+1) ) //coin->RTheight >= bp->bundleheight && coin->RTheight < bp->bundleheight+bp->n &&
{ {
if ( coin->RTheight < bp->hdrsi*coin->chain->bundlesize ) if ( coin->RTheight < bp->hdrsi*coin->chain->bundlesize )
coin->RTheight = bp->hdrsi*coin->chain->bundlesize; {
coin->lastRTheight = coin->RTheight = bp->hdrsi*coin->chain->bundlesize;
iguana_utxoaddrs_purge(coin);
}
if ( (block= bp->blocks[0]) == 0 || block->txvalid == 0 || block->mainchain == 0 ) if ( (block= bp->blocks[0]) == 0 || block->txvalid == 0 || block->mainchain == 0 )
{ {
if ( block != 0 ) if ( block != 0 )
@ -365,6 +371,7 @@ int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info *
flag++; flag++;
//coin->blocks.RO[bp->bundleheight+bundlei] = block->RO; //coin->blocks.RO[bp->bundleheight+bundlei] = block->RO;
coin->RTheight++; coin->RTheight++;
coin->lastRTheight = coin->RTheight;
//printf(">>>> RT.%d hwm.%d L.%d T.%d U.%d S.%d P.%d X.%d -> size.%ld\n",coin->RTheight,coin->blocks.hwmchain.height,coin->longestchain,dest->H.txidind,dest->H.unspentind,dest->H.spendind,dest->pkind,dest->externalind,(long)dest->H.data->allocsize); //printf(">>>> RT.%d hwm.%d L.%d T.%d U.%d S.%d P.%d X.%d -> size.%ld\n",coin->RTheight,coin->blocks.hwmchain.height,coin->longestchain,dest->H.txidind,dest->H.unspentind,dest->H.spendind,dest->pkind,dest->externalind,(long)dest->H.data->allocsize);
if ( coin->RTramchain.H.data != 0 ) if ( coin->RTramchain.H.data != 0 )
coin->RTramchain.H.data->numblocks = bundlei + 1; coin->RTramchain.H.data->numblocks = bundlei + 1;

1
iguana/iguana_volatiles.c

@ -335,7 +335,6 @@ void iguana_volatilespurge(struct iguana_info *coin,struct iguana_ramchain *ramc
ramchain->lastspendsfileptr = 0; ramchain->lastspendsfileptr = 0;
ramchain->lastspendsfilesize = 0; ramchain->lastspendsfilesize = 0;
} }
iguana_utxoaddrs_purge(coin);
} }
} }

2
includes/iguana_structs.h

@ -391,7 +391,7 @@ struct iguana_info
uint32_t fastfind; FILE *fastfps[0x100]; uint8_t *fast[0x100]; int32_t *fasttables[0x100]; long fastsizes[0x100]; uint32_t fastfind; FILE *fastfps[0x100]; uint8_t *fast[0x100]; int32_t *fasttables[0x100]; long fastsizes[0x100];
uint64_t instance_nonce,myservices,totalsize,totalrecv,totalpackets,sleeptime; uint64_t instance_nonce,myservices,totalsize,totalrecv,totalpackets,sleeptime;
int64_t mining,totalfees,TMPallocated,MAXRECVCACHE,MAXMEM,PREFETCHLAG,estsize,activebundles; int64_t mining,totalfees,TMPallocated,MAXRECVCACHE,MAXMEM,PREFETCHLAG,estsize,activebundles;
int32_t MAXPEERS,MAXPENDINGREQUESTS,MAXBUNDLES,MAXSTUCKTIME,active,closestbundle,numemitted,lastsweep,numemit,startutc,newramchain,numcached,cachefreed,helperdepth,startPEND,endPEND,enableCACHE,RELAYNODE,VALIDATENODE,origbalanceswritten,balanceswritten,RTheight,RTdatabad; int32_t MAXPEERS,MAXPENDINGREQUESTS,MAXBUNDLES,MAXSTUCKTIME,active,closestbundle,numemitted,lastsweep,numemit,startutc,newramchain,numcached,cachefreed,helperdepth,startPEND,endPEND,enableCACHE,RELAYNODE,VALIDATENODE,origbalanceswritten,balanceswritten,RTheight,lastRTheight,RTdatabad;
bits256 balancehash,allbundles; bits256 balancehash,allbundles;
uint32_t lastsync,parsetime,numiAddrs,lastpossible,bundlescount,savedblocks,backlog,spendvectorsaved,laststats,lastinv2,symbolcrc,spendvalidated; char VALIDATEDIR[512]; uint32_t lastsync,parsetime,numiAddrs,lastpossible,bundlescount,savedblocks,backlog,spendvectorsaved,laststats,lastinv2,symbolcrc,spendvalidated; char VALIDATEDIR[512];
int32_t longestchain,badlongestchain,longestchain_strange,RTramchain_busy,emitbusy,stuckiters,virtualchain; int32_t longestchain,badlongestchain,longestchain_strange,RTramchain_busy,emitbusy,stuckiters,virtualchain;

Loading…
Cancel
Save