Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
4e42c0399d
  1. 5
      iguana/iguana_bundles.c
  2. 1
      iguana/iguana_init.c
  3. 14
      iguana/iguana_volatiles.c
  4. 2
      includes/iguana_structs.h

5
iguana/iguana_bundles.c

@ -390,12 +390,15 @@ struct iguana_txid *iguana_bundletx(struct iguana_info *coin,struct iguana_bundl
{ {
static const bits256 zero; static const bits256 zero;
int32_t hdrsi,iter; struct iguana_txid *T; int64_t Toffset; char fname[1024]; FILE *fp; struct iguana_ramchaindata rdata,*rptr; int32_t hdrsi,iter; struct iguana_txid *T; int64_t Toffset; char fname[1024]; FILE *fp; struct iguana_ramchaindata rdata,*rptr;
if ( (rptr= bp->ramchain.H.data) != 0 )//|| (bp == coin->current && (rptr= coin->RTramchain.H.data) != 0) ) portable_mutex_lock(&coin->special_mutex);
if ( (rptr= bp->ramchain.H.data) != 0 || (bp == coin->current && (rptr= coin->RTramchain.H.data) != 0) )
{ {
T = RAMCHAIN_PTR(rptr,Toffset); T = RAMCHAIN_PTR(rptr,Toffset);
*tx = T[txidind]; *tx = T[txidind];
portable_mutex_unlock(&coin->special_mutex);
return(tx); return(tx);
} }
portable_mutex_unlock(&coin->special_mutex);
printf("bundletx without ramchain\n"); printf("bundletx without ramchain\n");
for (iter=0; iter<2; iter++) for (iter=0; iter<2; iter++)
{ {

1
iguana/iguana_init.c

@ -73,6 +73,7 @@ void iguana_initcoin(struct iguana_info *coin,cJSON *argjson)
usleep(1); usleep(1);
coin->startutc++; coin->startutc++;
printf("start.%u\n",coin->startutc); printf("start.%u\n",coin->startutc);
portable_mutex_init(&coin->special_mutex);
coin->startmillis = OS_milliseconds(), coin->starttime = tai_now(); coin->startmillis = OS_milliseconds(), coin->starttime = tai_now();
coin->avetime = 1 * 100; coin->avetime = 1 * 100;
//coin->R.maxrecvbundles = IGUANA_INITIALBUNDLES; //coin->R.maxrecvbundles = IGUANA_INITIALBUNDLES;

14
iguana/iguana_volatiles.c

@ -209,7 +209,6 @@ int32_t iguana_volatileupdate(struct iguana_info *coin,int32_t incremental,struc
} }
} }
printf("iguana_volatileupdate.%d: [%d] spent.(u%u %.8f pkind.%d) double spend? at ht.%d [%d] spendind.%d (%p %p)\n",incremental,spent_hdrsi,spent_unspentind,dstr(spent_value),spent_pkind,fromheight,fromheight/coin->chain->bundlesize,spendind,spentchain->Uextras,spentchain->A2); printf("iguana_volatileupdate.%d: [%d] spent.(u%u %.8f pkind.%d) double spend? at ht.%d [%d] spendind.%d (%p %p)\n",incremental,spent_hdrsi,spent_unspentind,dstr(spent_value),spent_pkind,fromheight,fromheight/coin->chain->bundlesize,spendind,spentchain->Uextras,spentchain->A2);
coin->RTdatabad = 1;
/*if ( coin->current != 0 && fromheight >= coin->current->bundleheight ) /*if ( coin->current != 0 && fromheight >= coin->current->bundleheight )
coin->RTdatabad = 1; coin->RTdatabad = 1;
else else
@ -220,12 +219,23 @@ int32_t iguana_volatileupdate(struct iguana_info *coin,int32_t incremental,struc
coin->spendvectorsaved = 0; coin->spendvectorsaved = 0;
coin->started = 0; coin->started = 0;
coin->active = 0;*/ coin->active = 0;*/
coin->RTdatabad = 1;
if ( coin->current != 0 && spent_hdrsi != coin->current->hdrsi && spent_hdrsi != fromheight/coin->chain->bundlesize ) if ( coin->current != 0 && spent_hdrsi != coin->current->hdrsi && spent_hdrsi != fromheight/coin->chain->bundlesize )
{ {
printf("restart iguana\n"); printf("restart iguana\n");
struct iguana_bundle *bp;
portable_mutex_lock(&coin->special_mutex);
if ( (bp= coin->bundles[spent_hdrsi]) != 0 )
{
iguana_bundleremove(coin,spent_hdrsi,0); iguana_bundleremove(coin,spent_hdrsi,0);
bp->ramchain.H.data = 0;
}
if ( (bp= coin->bundles[fromheight/coin->chain->bundlesize]) != 0 )
{
iguana_bundleremove(coin,fromheight/coin->chain->bundlesize,0); iguana_bundleremove(coin,fromheight/coin->chain->bundlesize,0);
//sleep(3); bp->ramchain.H.data = 0;
}
portable_mutex_unlock(&coin->special_mutex);
exit(-1); exit(-1);
} }
} }

2
includes/iguana_structs.h

@ -401,7 +401,7 @@ struct iguana_info
struct OS_memspace TXMEM,MEM,MEMB[IGUANA_MAXBUNDLESIZE]; struct OS_memspace TXMEM,MEM,MEMB[IGUANA_MAXBUNDLESIZE];
queue_t acceptQ,hdrsQ,blocksQ,priorityQ,possibleQ,cacheQ,recvQ,msgrequestQ; queue_t acceptQ,hdrsQ,blocksQ,priorityQ,possibleQ,cacheQ,recvQ,msgrequestQ;
double parsemillis,avetime; uint32_t Launched[8],Terminated[8]; double parsemillis,avetime; uint32_t Launched[8],Terminated[8];
portable_mutex_t peers_mutex,blocks_mutex; portable_mutex_t peers_mutex,blocks_mutex,special_mutex;
char changeaddr[64]; char changeaddr[64];
struct iguana_bundle *bundles[IGUANA_MAXBUNDLES],*current,*lastpending; struct iguana_bundle *bundles[IGUANA_MAXBUNDLES],*current,*lastpending;
struct iguana_ramchain RTramchain; struct OS_memspace RTmem,RThashmem; bits256 RThash1; struct iguana_ramchain RTramchain; struct OS_memspace RTmem,RThashmem; bits256 RThash1;

Loading…
Cancel
Save