diff --git a/iguana/iguana_ramchain.c b/iguana/iguana_ramchain.c index 81e274623..cf40ea97e 100755 --- a/iguana/iguana_ramchain.c +++ b/iguana/iguana_ramchain.c @@ -1171,7 +1171,7 @@ int32_t iguana_ramchain_free(struct iguana_info *coin,struct iguana_ramchain *ra if ( ramchain->A != ramchain->creditsA ) { //printf("hashmem.%p Free A %p %p, numpkinds.%d %ld\n",ramchain->hashmem,ramchain->A,ramchain->creditsA,ramchain->H.data->numpkinds,sizeof(*ramchain->A) * ramchain->H.data->numpkinds); - if ( ramchain->allocatedA != 0 ) + if ( deleteflag != 0 ) myfree(ramchain->A,sizeof(*ramchain->A) * ramchain->H.data->numpkinds), ramchain->A = 0; } //if ( ramchain->U2 != ramchain->roU2 ) @@ -1229,7 +1229,7 @@ int32_t iguana_bundleremove(struct iguana_info *coin,int32_t hdrsi) if ( hdrsi >= 0 && hdrsi < coin->bundlescount && (bp= coin->bundles[hdrsi]) != 0 ) { printf("delete bundle.[%d]\n",hdrsi); - iguana_ramchain_free(coin,&bp->ramchain,1); + iguana_ramchain_free(coin,&bp->ramchain,0); if ( iguana_bundlefname(coin,bp,fname) == 0 ) { printf("delete.(%s)\n",fname); diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 76a4fd680..512d702dc 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -1331,7 +1331,7 @@ void iguana_initfinal(struct iguana_info *coin,bits256 lastbundle) } if ( i < coin->bundlescount-1 ) { - printf("spendvectors.[%d] missing, will regen all of them\n",i); + //printf("spendvectors.[%d] missing, will regen all of them\n",i); for (i=0; ibundlescount-1; i++) { if ( coin->bundles[i] != 0 ) @@ -1592,7 +1592,9 @@ int32_t iguana_spendvectorconvs(struct iguana_info *coin,struct iguana_bundle *s } } else if ( bp->hdrsi > 0 && bp->hdrsi < coin->bundlescount-1 ) - printf("iguana_spendvectorconvs: [%d] null bp.%p or null tmpspends\n",i,bp); + { + //printf("iguana_spendvectorconvs: [%d] null bp.%p or null tmpspends\n",i,bp); + } } spentbp->converted = (uint32_t)time(NULL); //printf("spendvectorconvs.[%d] converted.%d\n",refbp->hdrsi,converted); @@ -1733,11 +1735,13 @@ void iguana_RThdrs(struct iguana_info *coin,struct iguana_bundle *bp,int32_t num void iguana_RTspendvectors(struct iguana_info *coin,struct iguana_bundle *bp) { - struct iguana_ramchain R; struct iguana_ramchaindata RDATA; + int32_t lasti; struct iguana_ramchain R; struct iguana_ramchaindata RDATA; bp->ramchain = coin->RTramchain; iguana_rdataset(&R,&RDATA,&coin->RTramchain); iguana_ramchain_prefetch(coin,&coin->RTramchain,0); - if ( iguana_spendvectors(coin,bp,&coin->RTramchain,coin->RTstarti,coin->RTheight%bp->n,0) < 0 ) + if ( (lasti= (coin->RTheight - ((coin->RTheight/bp->n)*bp->n))) >= bp->n-1 ) + lasti = bp->n - 1; + if ( iguana_spendvectors(coin,bp,&coin->RTramchain,coin->RTstarti,lasti,0) < 0 ) { printf("RTutxo error -> RTramchainfree\n"); iguana_RTramchainfree(coin); @@ -1805,9 +1809,6 @@ int32_t iguana_realtime_update(struct iguana_info *coin) bundlei = (coin->RTheight % coin->chain->bundlesize); block = iguana_bundleblock(coin,&hash2,bp,bundlei); iguana_bundlehashadd(coin,bp,bundlei,block); - //bp->blocks[bundlei] = block; - //if ( bits256_nonz(hash2) != 0 ) - // iguana_blockhashset("RTset",coin,bp->bundleheight+bundlei,hash2,1); printf("RT.%d vs hwm.%d starti.%d bp->n %d block.%p/%p ramchain.%p\n",coin->RTheight,coin->blocks.hwmchain.height,coin->RTstarti,bp->n,block,bp->blocks[bundlei],dest->H.data); if ( block != 0 && bits256_nonz(block->RO.prev_block) != 0 ) { diff --git a/iguana/main.c b/iguana/main.c index 90f541d56..69acb00dc 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -1202,7 +1202,7 @@ void iguana_main(void *arg) exit(-1); } sleep(1); - if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"VALIDATE\":1,\"prefetchlag\":13,\"startpend\":1,\"endpend\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":0,\"maxpeers\":64,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":1,\"poll\":10}"),0,myinfo->rpcport)) != 0 ) + if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"VALIDATE\":1,\"prefetchlag\":13,\"startpend\":1,\"endpend\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":0,\"maxpeers\":64,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":1,\"poll\":100}"),0,myinfo->rpcport)) != 0 ) { free(str); if ( 0 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"userhome\":\"/Users/jimbolaptop/Library/Application Support\",\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":1024,\"maxpeers\":256,\"newcoin\":\"BTCD\",\"active\":1}"),0,myinfo->rpcport)) != 0 )