diff --git a/iguana/iguana777.c b/iguana/iguana777.c index dfb5d7359..a321ed09a 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -600,7 +600,7 @@ void iguana_helper(void *arg) //portable_mutex_lock(&myinfo->allcoins_mutex); HASH_ITER(hh,myinfo->allcoins,coin,tmp) { - if ( coin->spendvectorsaved == 1 ) + if ( coin->spendvectorsaved == 1 && coin->firstRTheight == 0 ) iguana_utxogen(myinfo,coin,helperid,0); else if ( coin->spendvectorsaved > 1 && (coin->spendvalidated & (1 << helperid)) == 0 ) { diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index c5a91f379..8e9aa6a42 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -218,7 +218,7 @@ int32_t iguana_bundlehash2add(struct iguana_info *coin,struct iguana_block **blo } else { - if ( coin->RTheight > 0 && bp->bundleheight+bundlei > coin->firstRTheight ) + //if ( coin->RTheight > 0 && bp->bundleheight+bundlei > coin->firstRTheight ) { if ( bundlei > 1 ) bundlei -= 2; @@ -229,7 +229,8 @@ int32_t iguana_bundlehash2add(struct iguana_info *coin,struct iguana_block **blo return(-1); } //else printf("couldnt find block at %d\n",bp->bundleheight+bundlei); } - else if ( bundlei > 0 ) + //else if ( bundlei > 0 ) + if ( bp->blocks[bundlei] != 0 ) { printf("bp.[%d]->blocks[%d] mismatch %p != %p\n",bp->hdrsi,bundlei,bp->blocks[bundlei],block); bp->blocks[bundlei] = 0; diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index 79e8265e9..59f12848c 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -503,20 +503,23 @@ void iguana_gotblockM(struct iguana_info *coin,struct iguana_peer *addr,struct i }*/ } //else printf("cant save block\n"); } - numtx = origtxdata->zblock.RO.txn_count; - iguana_RTrawdata(coin,txdata->zblock.RO.hash2,data,&recvlen,&numtx,0); - req->zblock = txdata->zblock; - if ( coin->virtualchain != 0 ) - printf("%s recvlen.%d ipbits.%x prev.(%s)\n",coin->symbol,req->zblock.RO.recvlen,req->zblock.fpipbits,bits256_str(str,txdata->zblock.RO.prev_block)); - req->zblock.RO.txn_count = req->numtx = txdata->zblock.RO.txn_count; - if ( fromcache == 0 ) - { - coin->recvcount++; - coin->recvtime = (uint32_t)time(NULL); - netBLOCKS++; + if ( txdata->zblock.fpos == 0 ) + { + numtx = origtxdata->zblock.RO.txn_count; + iguana_RTrawdata(coin,txdata->zblock.RO.hash2,data,&recvlen,&numtx,0); + req->zblock = txdata->zblock; + if ( coin->virtualchain != 0 ) + printf("%s recvlen.%d ipbits.%x prev.(%s)\n",coin->symbol,req->zblock.RO.recvlen,req->zblock.fpipbits,bits256_str(str,txdata->zblock.RO.prev_block)); + req->zblock.RO.txn_count = req->numtx = txdata->zblock.RO.txn_count; + if ( fromcache == 0 ) + { + coin->recvcount++; + coin->recvtime = (uint32_t)time(NULL); + netBLOCKS++; + } + req->addr = addr; + queue_enqueue("recvQ",&coin->recvQ,&req->DL,0); } - req->addr = addr; - queue_enqueue("recvQ",&coin->recvQ,&req->DL,0); } void iguana_gottxidsM(struct iguana_info *coin,struct iguana_peer *addr,bits256 *txids,int32_t n) diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 646f6d0d9..2d3ae0d42 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -1185,7 +1185,7 @@ int64_t iguana_utxoaddr_gen(struct supernet_info *myinfo,struct iguana_info *coi if ( strcmp("BTC",coin->symbol) != 0 ) errs = iguana_utxoaddr_validate(myinfo,coin,height); printf("nogen %s HIST BALANCE %s %.8f errs %d\n",fname2,bits256_str(str,coin->utxoaddrhash),dstr(coin->histbalance),errs); - if ( errs == 0 && coin->histbalance > 0 ) + if ( errs == 0 && coin->histbalance > 0 && height > 0 ) { coin->firstRTheight = coin->RTheight = height; iguana_RTreset(coin); @@ -1308,7 +1308,7 @@ continue; printf("validating %s HIST BALANCE %s %.8f errs %d\n",fname2,bits256_str(str,coin->utxoaddrhash),dstr(coin->histbalance),errs); errs = iguana_utxoaddr_validate(myinfo,coin,height); printf("gen %s HIST BALANCE %s %.8f errs %d\n",fname2,bits256_str(str,coin->utxoaddrhash),dstr(coin->histbalance),errs); - if ( errs != 0 ) + if ( errs != 0 || height == 0 ) { printf("delete bad utxoaddr files\n"); OS_removefile(fname,0); diff --git a/iguana/main.c b/iguana/main.c index c59f1c760..2b3e79515 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -408,7 +408,7 @@ void mainloop(struct supernet_info *myinfo) //portable_mutex_lock(&myinfo->allcoins_mutex); HASH_ITER(hh,myinfo->allcoins,coin,tmp) { - if ( coin->RTheight == 0 && coin->current != 0 && coin->active != 0 && coin->started != 0 ) + if ( coin->RTheight == 0 && coin->firstRTheight == 0 && coin->current != 0 && coin->active != 0 && coin->started != 0 ) { isRT *= coin->isRT; if ( coin->peers != 0 )