diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 6b63de802..2575ac0b4 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -551,6 +551,8 @@ struct iguana_info *iguana_setcoin(char *symbol,void *launched,int32_t maxpeers, mult = (strcmp("BTC",coin->symbol) != 0) ? 512 : 1; maxval = (strcmp("BTC",coin->symbol) != 0) ? 2048 : 64; coin->MAXMEM = juint(json,"RAM"); + if ( (coin->MAXSTUCKTIME= juint(json,"maxstuck")) == 0 ) + coin->MAXSTUCKTIME = _IGUANA_MAXSTUCKTIME; if ( coin->MAXMEM == 0 ) coin->MAXMEM = IGUANA_DEFAULTRAM; if ( strcmp("BTC",coin->symbol) == 0 && coin->MAXMEM <= 4 ) diff --git a/iguana/iguana777.h b/iguana/iguana777.h index 60660fc6d..ff7c7a96a 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -26,7 +26,7 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t #define IGUANA_SERIALIZE_SPENDVECTORGEN //#define IGUANA_SERIALIZE_BALANCEGEN //#define IGUANA_DISABLEPEERS -#define IGUANA_MAXSTUCKTIME 77 +#define _IGUANA_MAXSTUCKTIME 77 #define IGUANA_MAXCOINS 64 #define IGUANA_MAXDELAY_MILLIS (3600 * 1000) @@ -463,7 +463,7 @@ struct iguana_info struct iguana_peers peers; uint64_t instance_nonce,myservices,totalsize,totalrecv,totalpackets,sleeptime; int64_t mining,totalfees,TMPallocated,MAXRECVCACHE,MAXMEM,estsize,activebundles; - int32_t MAXPEERS,MAXPENDING,MAXBUNDLES,active,closestbundle,numemitted,lastsweep,startutc,newramchain,numcached,cachefreed,helperdepth,startPEND,endPEND,enableCACHE,RELAYNODE,VALIDATENODE,balanceswritten,RTheight; bits256 balancehash; + int32_t MAXPEERS,MAXPENDING,MAXBUNDLES,MAXSTUCKTIME,active,closestbundle,numemitted,lastsweep,startutc,newramchain,numcached,cachefreed,helperdepth,startPEND,endPEND,enableCACHE,RELAYNODE,VALIDATENODE,balanceswritten,RTheight; bits256 balancehash; uint32_t lastsync,parsetime,numiAddrs,lastpossible,bundlescount,savedblocks,backlog; int32_t longestchain,badlongestchain,longestchain_strange,RTramchain_busy,emitbusy; struct tai starttime; double startmillis; diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index 96ed7dd8c..9c1322217 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -928,9 +928,9 @@ int32_t iguana_bundleiters(struct iguana_info *coin,struct OS_memspace *mem,stru if ( coin->stucktime != 0 ) { lag = time(NULL)-coin->stucktime; - if ( lag == IGUANA_MAXSTUCKTIME/2 || lag == 3*IGUANA_MAXSTUCKTIME/4 ) + if ( lag == coin->MAXSTUCKTIME/2 || lag == 3*coin->MAXSTUCKTIME/4 ) { - if ( lag > IGUANA_MAXSTUCKTIME/2 ) + if ( lag > coin->MAXSTUCKTIME/2 ) { struct iguana_blockreq *breq; while ( (breq= queue_dequeue(&coin->blocksQ,0)) != 0 ) diff --git a/iguana/main.c b/iguana/main.c index 3a321a09b..4f7e83fb7 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -373,7 +373,7 @@ void mainloop(struct supernet_info *myinfo) } myfree(ptr,ptr->allocsize); } - if ( coin->stucktime != 0 && coin->isRT == 0 && coin->RTheight == 0 && (time(NULL) - coin->stucktime) > IGUANA_MAXSTUCKTIME ) + if ( coin->stucktime != 0 && coin->isRT == 0 && coin->RTheight == 0 && (time(NULL) - coin->stucktime) > coin->MAXSTUCKTIME ) { printf("%s is stuck too long, restarting\n",coin->symbol); iguana_coinpurge(coin);