|
|
@ -17,8 +17,9 @@ |
|
|
|
|
|
|
|
void iguana_RTramchainfree(struct iguana_info *coin,struct iguana_bundle *bp) |
|
|
|
{ |
|
|
|
return; |
|
|
|
#ifdef ENABLE_RAMCHAIN |
|
|
|
int32_t hdrsi; |
|
|
|
return; |
|
|
|
//portable_mutex_lock(&coin->RTmutex);
|
|
|
|
if ( coin->utxotable != 0 ) |
|
|
|
{ |
|
|
@ -43,12 +44,14 @@ return; |
|
|
|
printf("done RTramchain\n"); |
|
|
|
} |
|
|
|
//portable_mutex_unlock(&coin->RTmutex);
|
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
void *iguana_ramchainfile(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_ramchain *dest,struct iguana_ramchain *R,struct iguana_bundle *bp,int32_t bundlei,struct iguana_block *block) |
|
|
|
{ |
|
|
|
return(0); |
|
|
|
#ifdef ENABLE_RAMCHAIN |
|
|
|
char fname[1024]; long filesize; int32_t err; void *ptr=0; |
|
|
|
return(0); |
|
|
|
if ( block == bp->blocks[bundlei] && (ptr= iguana_bundlefile(coin,fname,&filesize,bp,bundlei)) != 0 ) |
|
|
|
{ |
|
|
|
if ( iguana_mapchaininit(fname,coin,R,bp,bundlei,block,ptr,filesize) >= 0 ) |
|
|
@ -67,12 +70,14 @@ return(0); |
|
|
|
iguana_ramchain_free(coin,R,1); |
|
|
|
} //else printf("ramchainfile ptr.%p block.%p\n",ptr,block);
|
|
|
|
return(0); |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
void iguana_RTramchainalloc(char *fname,struct iguana_info *coin,struct iguana_bundle *bp) |
|
|
|
{ |
|
|
|
return; |
|
|
|
#ifdef ENABLE_RAMCHAIN |
|
|
|
uint32_t i,changed = 0; struct iguana_ramchaindata *rdata; struct iguana_ramchain *dest = &coin->RTramchain; struct iguana_blockRO *B; struct iguana_bundle *tmpbp; |
|
|
|
return; |
|
|
|
//portable_mutex_lock(&coin->RTmutex);
|
|
|
|
if ( (rdata= dest->H.data) != 0 ) |
|
|
|
{ |
|
|
@ -116,11 +121,13 @@ return; |
|
|
|
} |
|
|
|
} |
|
|
|
//portable_mutex_unlock(&coin->RTmutex);
|
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
void iguana_rdataset(struct iguana_ramchain *dest,struct iguana_ramchaindata *rdest,struct iguana_ramchain *src) |
|
|
|
{ |
|
|
|
return; |
|
|
|
return; |
|
|
|
#ifdef ENABLE_RAMCHAIN |
|
|
|
*dest = *src; |
|
|
|
dest->H.data = rdest; |
|
|
|
*rdest = *src->H.data; |
|
|
@ -130,11 +137,13 @@ return; |
|
|
|
rdest->numunspents = src->H.unspentind; |
|
|
|
rdest->numspends = src->H.spendind; |
|
|
|
//printf("RT set numtxids.%u numspends.%u\n",rdest->numtxids,rdest->numspends);
|
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
void iguana_rdatarestore(struct iguana_ramchain *dest,struct iguana_ramchaindata *rdest,struct iguana_ramchain *src) |
|
|
|
{ |
|
|
|
return; |
|
|
|
return; |
|
|
|
#ifdef ENABLE_RAMCHAIN |
|
|
|
*src = *dest; |
|
|
|
*src->H.data = *rdest; |
|
|
|
src->pkind = rdest->numpkinds; |
|
|
@ -143,12 +152,14 @@ return; |
|
|
|
src->H.unspentind = rdest->numunspents; |
|
|
|
src->H.spendind = rdest->numspends; |
|
|
|
printf("RT restore numtxids.%u numspends.%u\n",rdest->numtxids,rdest->numspends); |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
void iguana_RThdrs(struct iguana_info *coin,struct iguana_bundle *bp,int32_t numaddrs) |
|
|
|
{ |
|
|
|
return; |
|
|
|
#ifdef ENABLE_RAMCHAIN |
|
|
|
int32_t datalen,i; uint8_t serialized[512]; char str[65]; struct iguana_peer *addr; |
|
|
|
return; |
|
|
|
if ( coin->peers == 0 ) |
|
|
|
return; |
|
|
|
datalen = iguana_gethdrs(coin,serialized,coin->chain->gethdrsmsg,bits256_str(str,bp->hashes[0])); |
|
|
@ -163,12 +174,14 @@ return; |
|
|
|
//addr->pendhdrs++;
|
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
void iguana_RTspendvectors(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_bundle *bp) |
|
|
|
{ |
|
|
|
return; |
|
|
|
#ifdef ENABLE_RAMCHAIN |
|
|
|
int32_t iterate,lasti,num,hdrsi,orignumemit; struct iguana_ramchain R; struct iguana_ramchaindata RDATA; |
|
|
|
return; |
|
|
|
if ( bp->hdrsi <= 0 ) |
|
|
|
return; |
|
|
|
printf("RTspendvectors [%d]\n",bp->hdrsi); |
|
|
@ -212,14 +225,17 @@ return; |
|
|
|
//printf("iguana_balancegen [%d] (%d to %d)\n",bp->hdrsi,coin->RTstarti,(coin->RTheight-1)%bp->n);
|
|
|
|
coin->RTstarti = coin->RTheight; |
|
|
|
} |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info *coin) |
|
|
|
{ |
|
|
|
return(0); |
|
|
|
#ifdef ENABLE_RAMCHAIN |
|
|
|
double startmillis0; static double totalmillis0; static int32_t num0; |
|
|
|
struct iguana_bundle *bp; struct iguana_ramchaindata *rdata; int32_t offset,bundlei,i,n,flag=0; bits256 hash2,*ptr; struct iguana_peer *addr; |
|
|
|
struct iguana_block *block=0; struct iguana_blockRO *B; struct iguana_ramchain *dest=0,blockR; |
|
|
|
//if ( coin->peers == 0 && coin->virtualchain == 0 )
|
|
|
|
if ( coin->peers == 0 && coin->virtualchain == 0 ) |
|
|
|
return(0); |
|
|
|
offset = 0;//(strcmp("BTC",coin->symbol) != 0);
|
|
|
|
if ( coin->RTheight >= (coin->current->hdrsi+1)*coin->chain->bundlesize ) |
|
|
@ -245,7 +261,7 @@ int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info * |
|
|
|
} |
|
|
|
if ( coin->spendvectorsaved <= 1 ) |
|
|
|
{ |
|
|
|
//printf("%s spendvectorsaved not yet\n",coin->symbol);
|
|
|
|
//printf("%s spendvectorsaved not yet\n",coin->symbol);
|
|
|
|
usleep(100000); |
|
|
|
return(0); |
|
|
|
} |
|
|
@ -278,10 +294,10 @@ int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info * |
|
|
|
coin->lastRTheight = coin->RTheight = 0; |
|
|
|
iguana_utxoaddrs_purge(coin); |
|
|
|
/*while ( coin->spendvectorsaved <= 1 )
|
|
|
|
{ |
|
|
|
fprintf(stderr,"wait for spendvectorsaved\n"); |
|
|
|
sleep(3); |
|
|
|
}*/ |
|
|
|
{ |
|
|
|
fprintf(stderr,"wait for spendvectorsaved\n"); |
|
|
|
sleep(3); |
|
|
|
}*/ |
|
|
|
return(0); |
|
|
|
} |
|
|
|
if ( coin->RTdatabad == 0 && bp->hdrsi >= (coin->longestchain/coin->chain->bundlesize)-1 && bp->hdrsi >= coin->balanceswritten-2 && ((coin->RTheight < coin->blocks.hwmchain.height-offset && time(NULL) > bp->lastRT) || time(NULL) > bp->lastRT+1) ) //coin->RTheight >= bp->bundleheight && coin->RTheight < bp->bundleheight+bp->n &&
|
|
|
@ -443,4 +459,5 @@ int32_t iguana_realtime_update(struct supernet_info *myinfo,struct iguana_info * |
|
|
|
//portable_mutex_unlock(&coin->RTmutex);
|
|
|
|
} |
|
|
|
return(flag); |
|
|
|
#endif |
|
|
|
} |
|
|
|