diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 154e50406..ceca16074 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -78,6 +78,7 @@ struct iguana_info *iguana_coinadd(char *symbol,char *name,cJSON *argjson,int32_ printf("ADD ALLCOINS.(%s) name.(%s) size %ld numvirts.%d\n",symbol,name,sizeof(*coin),myinfo->allcoins_numvirts); coin->symbolcrc = symbolcrc = calc_crc32(0,symbol,(int32_t)strlen(symbol)); //portable_mutex_lock(&myinfo->allcoins_mutex); + coin->coinid = myinfo->totalcoins++; HASH_ADD(hh,myinfo->allcoins,symbolcrc,sizeof(coin->symbolcrc),coin); //portable_mutex_unlock(&myinfo->allcoins_mutex); struct iguana_info *virt,*tmp; @@ -755,7 +756,7 @@ void iguana_helper(void *arg) } } } - if ( helperid == 0 ) + if ( (helperid % IGUANA_NUMHELPERS) == (coin->coinid % IGUANA_NUMHELPERS) ) iguana_coin_mainiter(myinfo,coin,&numpeers,&MEM,MEMB); } } @@ -932,11 +933,11 @@ void iguana_coinloop(void *arg) } if ( coin->FULLNODE != 0 || coin->VALIDATENODE != 0 || coin->MAXPEERS == 1 ) { - portable_mutex_lock(&coin->allcoins_mutex); + //portable_mutex_lock(&coin->allcoins_mutex); coin->busy_processing = 1; flag += iguana_processrecv(myinfo,coin); coin->busy_processing = 0; - portable_mutex_unlock(&coin->allcoins_mutex); + //portable_mutex_unlock(&coin->allcoins_mutex); /*if ( strcmp(coin->symbol,"BTCD") == 0 && coin->RTheight > 0 && coin->RTheight > coin->chain->bundlesize ) { int32_t hdrsi,nonz,errs; struct iguana_pkhash *refP; struct iguana_bundle *bp; diff --git a/iguana/iguana777.h b/iguana/iguana777.h index 061db9adc..ee45bc7d1 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -77,7 +77,7 @@ struct supernet_info char ipaddr[64],NXTAPIURL[512],secret[4096],password[4096],rpcsymbol[64],handle[1024],permanentfile[1024]; char *decryptstr; int32_t maxdelay,IAMRELAY,IAMNOTARY,IAMLP,publicRPC,basilisk_busy,genesisresults,remoteorigin; - uint32_t expiration,dirty,DEXactive,DEXpoll; + uint32_t expiration,dirty,DEXactive,DEXpoll,totalcoins; uint16_t argport,rpcport; struct basilisk_info basilisks; struct exchange_info *tradingexchanges[SUPERNET_MAXEXCHANGES]; int32_t numexchanges; diff --git a/iguana/iguana_init.c b/iguana/iguana_init.c index 3cab6200e..52e152492 100755 --- a/iguana/iguana_init.c +++ b/iguana/iguana_init.c @@ -68,7 +68,6 @@ void iguana_initcoin(struct iguana_info *coin,cJSON *argjson) portable_mutex_init(&coin->blocks_mutex); portable_mutex_init(&coin->special_mutex); portable_mutex_init(&coin->allcoins_mutex); - portable_mutex_init(&coin->allcoins_mutex); coin->txfee = 10000; iguana_meminit(&coin->blockMEM,"blockMEM",coin->blockspace,coin->blockspacesize,0); iguana_initQs(coin); diff --git a/iguana/main.c b/iguana/main.c index 1c5ef4efd..bc7c7bbe4 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -457,8 +457,7 @@ rm BTC.xz; mksquashfs DB/BTC BTC.xz -comp xz -b 1048576 -comp xz -Xdict-size 102 void mainloop(struct supernet_info *myinfo) { - struct iguana_info *coin,*tmp; int32_t i,counter=0,depth; portable_mutex_t *stack[IGUANA_MAXCOINS]; - double lastmilli = 0; + struct iguana_info *coin; int32_t counter=0,depth; double lastmilli = 0; sleep(3); printf("mainloop\n"); while ( 1 ) @@ -472,25 +471,9 @@ void mainloop(struct supernet_info *myinfo) counter++; coin = 0; depth = 0; - if ( 1 ) - { - HASH_ITER(hh,myinfo->allcoins,coin,tmp) - { - portable_mutex_lock(&coin->allcoins_mutex); - stack[depth++] = &coin->allcoins_mutex; - } - } //printf("check jsonQ\n"); while ( iguana_jsonQ(myinfo,0) != 0 ) ; - if ( 1 ) - { - if ( depth > 0 ) - { - for (i=depth-1; i>=0; i--) - portable_mutex_unlock(stack[i]); - } - } lastmilli = OS_milliseconds(); } usleep(30000); diff --git a/includes/iguana_structs.h b/includes/iguana_structs.h index 0b37c4ca9..b4f6166c0 100755 --- a/includes/iguana_structs.h +++ b/includes/iguana_structs.h @@ -483,7 +483,7 @@ struct iguana_info struct OS_memspace RTrawmem,RTmem,RThashmem; // struct iguana_ramchain RTramchain; bits256 RThash1; int32_t numremain,numpendings,zcount,recvcount,bcount,pcount,lastbundle,numsaved,pendbalances,numverified,blockdepth; - uint32_t recvtime,hdrstime,backstoptime,lastbundletime,numreqsent,numbundlesQ,lastbundleitime,lastdisp,RTgenesis,firstRTgenesis,RTstarti,idletime,stucktime,stuckmonitor,maxstuck,lastreqtime,RThdrstime,nextchecked,lastcheckpoint,sigserrs,sigsvalidated; + uint32_t recvtime,hdrstime,backstoptime,lastbundletime,numreqsent,numbundlesQ,lastbundleitime,lastdisp,RTgenesis,firstRTgenesis,RTstarti,idletime,stucktime,stuckmonitor,maxstuck,lastreqtime,RThdrstime,nextchecked,lastcheckpoint,sigserrs,sigsvalidated,coinid; double bandwidth,maxbandwidth,backstopmillis; bits256 backstophash2; int64_t spaceused; int32_t disableUTXO,initialheight,mapflags,minconfirms,numrecv,bindsock,isRT,backstop,blocksrecv,merging,firstRTheight,polltimeout,numreqtxids,allhashes,balanceflush,basilisk_busy,almostRT,busy_processing; bits256 reqtxids[64]; void *launched,*started,*rpcloop;