jl777 8 years ago
parent
commit
da03e45935
  1. 7
      iguana/iguana777.c
  2. 1
      iguana/iguana_recv.c
  3. 23
      iguana/main.c
  4. 2
      includes/iguana_structs.h

7
iguana/iguana777.c

@ -933,18 +933,21 @@ void iguana_coinloop(void *arg)
if ( coin->FULLNODE != 0 || coin->VALIDATENODE != 0 || coin->MAXPEERS == 1 )
{
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);
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;
hdrsi = (coin->RTheight / coin->chain->bundlesize) - 1;
if ( 0 && (bp= coin->bundles[hdrsi]) != 0 && bp->weights == 0 )
bp->weights = iguana_PoS_weights(myinfo,coin,&refP,&bp->supply,&bp->numweights,&nonz,&errs,bp->bundleheight);
}
}*/
}
}
coin->idletime = (uint32_t)time(NULL);
iguana_jsonQ(myinfo,coin);
}
}
//iguana_jsonQ();

1
iguana/iguana_recv.c

@ -2275,7 +2275,6 @@ int32_t iguana_processrecv(struct supernet_info *myinfo,struct iguana_info *coin
flag += iguana_processrecvQ(myinfo,coin,&newhwm);
if ( coin->RTheight == 0 || (rand() % 7) == 0 )
flag += iguana_reqblocks(myinfo,coin);
iguana_jsonQ(myinfo,coin);
if ( time(NULL) > coin->laststats+3 )
{
flag += iguana_reqhdrs(coin);

23
iguana/main.c

@ -253,7 +253,7 @@ char *iguana_blockingjsonstr(struct supernet_info *myinfo,struct iguana_info *co
char *SuperNET_processJSON(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *json,char *remoteaddr,uint16_t port)
{
cJSON *retjson; uint64_t tag; uint32_t timeout; char *jsonstr,*retjsonstr,*retstr = 0; //*hexmsg,*method,
cJSON *retjson; double endmillis; uint64_t tag; uint32_t timeout,immedmillis; char *jsonstr,*retjsonstr,*retstr = 0; //*hexmsg,*method,
//char str[65]; printf("processJSON %p %s\n",&myinfo->privkey,bits256_str(str,myinfo->privkey));
if ( json != 0 )
{
@ -272,9 +272,24 @@ char *SuperNET_processJSON(struct supernet_info *myinfo,struct iguana_info *coin
}*/
jsonstr = jprint(json,0);
//printf("RPC? (%s)\n",jsonstr);
if ( jstr(json,"immediate") != 0 || ((remoteaddr == 0 || remoteaddr[0] == 0) && port == IGUANA_RPCPORT) )
retjsonstr = SuperNET_jsonstr(myinfo,jsonstr,remoteaddr,port);
else retjsonstr = iguana_blockingjsonstr(myinfo,coin,jsonstr,tag,timeout,remoteaddr,port);
if ( (immedmillis= juint(json,"immediate")) != 0 || ((remoteaddr == 0 || remoteaddr[0] == 0) && port == IGUANA_RPCPORT) )
{
if ( coin != 0 )
{
endmillis = OS_milliseconds() + immedmillis;
while ( 1 )
{
if ( coin->busy_processing == 0 )
break;
usleep(100);
if ( OS_milliseconds() > endmillis )
break;
}
if ( coin->busy_processing == 0 )
retjsonstr = SuperNET_jsonstr(myinfo,jsonstr,remoteaddr,port);
else retjsonstr = clonestr("{\"error\":\"coin is busy processing\"}");
} else retjsonstr = SuperNET_jsonstr(myinfo,jsonstr,remoteaddr,port);
} else retjsonstr = iguana_blockingjsonstr(myinfo,coin,jsonstr,tag,timeout,remoteaddr,port);
if ( retjsonstr != 0 )
{
if ( (retjsonstr[0] == '{' || retjsonstr[0] == '[') && (retjson= cJSON_Parse(retjsonstr)) != 0 )

2
includes/iguana_structs.h

@ -485,7 +485,7 @@ struct iguana_info
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;
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; 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;
uint64_t bloomsearches,bloomhits,bloomfalse,collisions,txfee_perkb,txfee;
uint8_t *blockspace; int32_t blockspacesize; struct OS_memspace blockMEM,RTHASHMEM;

Loading…
Cancel
Save