jl777 8 years ago
parent
commit
848907b125
  1. 7
      iguana/iguana777.c
  2. 2
      iguana/iguana777.h
  3. 1
      iguana/iguana_init.c
  4. 19
      iguana/main.c
  5. 2
      includes/iguana_structs.h

7
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); 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)); coin->symbolcrc = symbolcrc = calc_crc32(0,symbol,(int32_t)strlen(symbol));
//portable_mutex_lock(&myinfo->allcoins_mutex); //portable_mutex_lock(&myinfo->allcoins_mutex);
coin->coinid = myinfo->totalcoins++;
HASH_ADD(hh,myinfo->allcoins,symbolcrc,sizeof(coin->symbolcrc),coin); HASH_ADD(hh,myinfo->allcoins,symbolcrc,sizeof(coin->symbolcrc),coin);
//portable_mutex_unlock(&myinfo->allcoins_mutex); //portable_mutex_unlock(&myinfo->allcoins_mutex);
struct iguana_info *virt,*tmp; 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); 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 ) 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; coin->busy_processing = 1;
flag += iguana_processrecv(myinfo,coin); flag += iguana_processrecv(myinfo,coin);
coin->busy_processing = 0; 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 ) /*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; int32_t hdrsi,nonz,errs; struct iguana_pkhash *refP; struct iguana_bundle *bp;

2
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 ipaddr[64],NXTAPIURL[512],secret[4096],password[4096],rpcsymbol[64],handle[1024],permanentfile[1024];
char *decryptstr; char *decryptstr;
int32_t maxdelay,IAMRELAY,IAMNOTARY,IAMLP,publicRPC,basilisk_busy,genesisresults,remoteorigin; 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; uint16_t argport,rpcport;
struct basilisk_info basilisks; struct basilisk_info basilisks;
struct exchange_info *tradingexchanges[SUPERNET_MAXEXCHANGES]; int32_t numexchanges; struct exchange_info *tradingexchanges[SUPERNET_MAXEXCHANGES]; int32_t numexchanges;

1
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->blocks_mutex);
portable_mutex_init(&coin->special_mutex); portable_mutex_init(&coin->special_mutex);
portable_mutex_init(&coin->allcoins_mutex); portable_mutex_init(&coin->allcoins_mutex);
portable_mutex_init(&coin->allcoins_mutex);
coin->txfee = 10000; coin->txfee = 10000;
iguana_meminit(&coin->blockMEM,"blockMEM",coin->blockspace,coin->blockspacesize,0); iguana_meminit(&coin->blockMEM,"blockMEM",coin->blockspace,coin->blockspacesize,0);
iguana_initQs(coin); iguana_initQs(coin);

19
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) void mainloop(struct supernet_info *myinfo)
{ {
struct iguana_info *coin,*tmp; int32_t i,counter=0,depth; portable_mutex_t *stack[IGUANA_MAXCOINS]; struct iguana_info *coin; int32_t counter=0,depth; double lastmilli = 0;
double lastmilli = 0;
sleep(3); sleep(3);
printf("mainloop\n"); printf("mainloop\n");
while ( 1 ) while ( 1 )
@ -472,25 +471,9 @@ void mainloop(struct supernet_info *myinfo)
counter++; counter++;
coin = 0; coin = 0;
depth = 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"); //printf("check jsonQ\n");
while ( iguana_jsonQ(myinfo,0) != 0 ) 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(); lastmilli = OS_milliseconds();
} }
usleep(30000); usleep(30000);

2
includes/iguana_structs.h

@ -483,7 +483,7 @@ struct iguana_info
struct OS_memspace RTrawmem,RTmem,RThashmem; // struct iguana_ramchain RTramchain; struct OS_memspace RTrawmem,RTmem,RThashmem; // struct iguana_ramchain RTramchain;
bits256 RThash1; bits256 RThash1;
int32_t numremain,numpendings,zcount,recvcount,bcount,pcount,lastbundle,numsaved,pendbalances,numverified,blockdepth; 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; 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]; 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; void *launched,*started,*rpcloop;

Loading…
Cancel
Save