diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 974bf9a2d..df68b3070 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -440,9 +440,6 @@ void iguana_coinloop(void *arg) n = (int32_t)(long)coins[0]; coins++; printf("begin coinloop[%d]\n",n); - for (i=0; iblocks.hash != 0 ) + if ( coin->blocks.hash != 0 ) { HASH_ITER(hh,coin->blocks.hash,block,tmp) { @@ -372,9 +372,12 @@ void iguana_blockspurge(struct iguana_info *coin) void iguana_coinpurge(struct iguana_info *coin) { - int32_t i; struct iguana_bundle *bp; char *hashstr; struct iguana_bundlereq *req; struct iguana_blockreq *breq; - coin->started = 0; coin->active = 0; + int32_t i,saved; struct iguana_bundle *bp; char *hashstr; struct iguana_bundlereq *req; struct iguana_blockreq *breq; struct iguana_helper *ptr; + saved = coin->active, coin->active = 0; + coin->started = 0; coin->RTgenesis = 0; + while ( (ptr= queue_dequeue(&bundlesQ,0)) != 0 ) + myfree(ptr,ptr->allocsize); if ( 1 ) { while ( (hashstr= queue_dequeue(&coin->hdrsQ,1)) != 0 ) @@ -389,7 +392,7 @@ void iguana_coinpurge(struct iguana_info *coin) { if ( req->blocks != 0 ) myfree(req->blocks,sizeof(*req->blocks) * req->n), req->blocks = 0; - if ( 0 && req->hashes != 0 ) + if ( req->hashes != 0 ) myfree(req->hashes,sizeof(*req->hashes) * req->n), req->hashes = 0; myfree(req,req->allocsize); } @@ -407,6 +410,7 @@ void iguana_coinpurge(struct iguana_info *coin) coin->current = coin->lastpending = 0; memset(coin->bundles,0,sizeof(coin->bundles)); iguana_blockspurge(coin); + coin->active = saved; } struct iguana_info *iguana_coinstart(struct iguana_info *coin,int32_t initialheight,int32_t mapflags) diff --git a/iguana/iguana_json.c b/iguana/iguana_json.c index d7b220f56..df92b49fe 100755 --- a/iguana/iguana_json.c +++ b/iguana/iguana_json.c @@ -623,12 +623,9 @@ STRING_ARG(iguana,startcoin,activecoin) STRING_ARG(iguana,stopcoin,activecoin) { - struct iguana_helper *ptr; if ( coin != 0 ) { coin->active = 0; - while ( (ptr= queue_dequeue(&bundlesQ,0)) != 0 ) - myfree(ptr,ptr->allocsize); iguana_coinpurge(coin); return(clonestr("{\"result\":\"coin stopped\"}")); } else return(clonestr("{\"error\":\"stopcoin needs coin\"}")); diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 68015420f..535e0381b 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -1411,9 +1411,6 @@ int32_t iguana_balanceflush(struct iguana_info *coin,int32_t refhdrsi,int32_t pu printf("error mapping bundle.[%d]\n",hdrsi); } char str[65]; printf("BALANCES WRITTEN for %d bundles %s\n",coin->balanceswritten,bits256_str(str,coin->balancehash)); - struct iguana_helper *ptr; - while ( (ptr= queue_dequeue(&bundlesQ,0)) != 0 ) - myfree(ptr,ptr->allocsize); iguana_coinpurge(coin); //exit(-1); //coin->balanceswritten = iguana_volatileinit(coin); diff --git a/iguana/main.c b/iguana/main.c index 9803d1999..1aaa21c5b 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -390,9 +390,6 @@ void mainloop(struct supernet_info *myinfo) printf("%s is stuck too long, purging files for %d\n",coin->symbol,bp->hdrsi); if ( coin->started != 0 ) { - struct iguana_helper *ptr; - while ( (ptr= queue_dequeue(&bundlesQ,0)) != 0 ) - myfree(ptr,ptr->allocsize); iguana_coinpurge(coin); while ( coin->started == 0 ) {