Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
23510fd772
  1. 2
      iguana/iguana_bundles.c
  2. 8
      iguana/iguana_ramchain.c
  3. 21
      iguana/iguana_unspents.c
  4. 7
      iguana/main.c

2
iguana/iguana_bundles.c

@ -1357,7 +1357,7 @@ void iguana_bundlestats(struct iguana_info *coin,char *str,int32_t lag)
}
}
//sprintf(str+strlen(str),"%s.%-2d %s time %.2f files.%d Q.%d %d\n",coin->symbol,flag,str,(double)(time(NULL)-coin->starttime)/60.,coin->peers.numfiles,queue_size(&coin->priorityQ),queue_size(&coin->blocksQ));
if ( time(NULL) > coin->lastdisp+77 && (strcmp(str,coin->lastdispstr) != 0 || time(NULL) > coin->lastdisp+600) )
if ( time(NULL) > coin->lastdisp+7 && (strcmp(str,coin->lastdispstr) != 0 || time(NULL) > coin->lastdisp+60) )
{
printf("%s bQ.%d %d:%02d:%02d stuck.%d max.%d\n",str,queue_size(&bundlesQ),(int32_t)difft.x/3600,(int32_t)(difft.x/60)%60,(int32_t)difft.x%60,coin->stucktime!=0?(uint32_t)time(NULL) - coin->stucktime:0,coin->maxstuck);
strcpy(coin->lastdispstr,str);

8
iguana/iguana_ramchain.c

@ -1802,7 +1802,7 @@ long iguana_ramchain_data(struct iguana_info *coin,struct iguana_peer *addr,stru
int32_t verifyflag = 0;
RAMCHAIN_DECLARE; uint32_t addr_ipbits; struct iguana_ramchain R,*mapchain,*ramchain = &addr->ramchain;
struct iguana_msgtx *tx; char fname[1024]; uint8_t rmd160[20]; // long fsize; void *ptr;
int32_t i,j,fpos,pubkeysize,msize,sigsize,firsti=1,err,flag,bundlei = -2; bits256 merkle_root;
int32_t i,j,fpos,pubkeysize,msize,sigsize,subdir,firsti=1,err,flag,bundlei = -2; bits256 merkle_root;
struct iguana_bundle *bp = 0; struct iguana_block *block; uint32_t scriptspace,stackspace;
totalrecv += recvlen;
#ifdef __PNACL__
@ -1887,7 +1887,9 @@ long iguana_ramchain_data(struct iguana_info *coin,struct iguana_peer *addr,stru
block->fpos = fpos = -1;
iguana_ramchain_link(ramchain,block->RO.hash2,bp->hdrsi,bp->bundleheight+bundlei,bundlei,1,firsti,0);
_iguana_ramchain_setptrs(RAMCHAIN_PTRS,ramchain->H.data);
char dirname[1024]; sprintf(dirname,"%s/%s/%d",GLOBAL_TMPDIR,coin->symbol,bp->bundleheight), OS_ensure_directory(dirname);
subdir = bp->bundleheight / IGUANA_SUBDIRDIVISOR;
char dirname[1024]; sprintf(dirname,"%s/%s/%d",GLOBAL_TMPDIR,coin->symbol,subdir), OS_ensure_directory(dirname);
sprintf(dirname,"%s/%s/%d/%d",GLOBAL_TMPDIR,coin->symbol,subdir,bp->bundleheight), OS_ensure_directory(dirname);
//printf("Kspace.%p bp.[%d:%d] <- scriptspace.%d expanded.%d\n",Kspace,bp->hdrsi,bundlei,scriptspace,ramchain->expanded);
if ( T == 0 || U == 0 || S == 0 || B == 0 )
{
@ -2362,8 +2364,10 @@ int64_t iguana_ramchainopen(char *fname,struct iguana_info *coin,struct iguana_r
if ( rdata->scriptspace > scriptspace )
scriptspace = rdata->scriptspace;
}
#ifndef __APPLE__
numtxids *= 2.5; numexternaltxids *= 2.5, scriptspace *= 2.5;
numunspents *= 2.5, numspends *= 2.5, numpkinds *= 2.5;
#endif
if ( mem->ptr == 0 )
{
while ( (allocsize= _iguana_rdata_action(fname,0,0,0,0,1,numtxids,numunspents,numspends,numpkinds,numexternaltxids,scriptspace,0,0,0,0,0,RAMCHAIN_ARG,numblocks)) > 2*1024LL*1024L*1024L )

21
iguana/iguana_unspents.c

@ -122,7 +122,7 @@ int32_t iguana_alloctxbits(struct iguana_info *coin,struct iguana_ramchain *ramc
ramchain->txbits = calloc(1,tlen);
memcpy(ramchain->txbits,TXbits,tlen);
total += tlen;
//char str[65]; printf("alloc.[%d] txbits.%p[%d] total %s\n",ramchain->H.data->height/coin->chain->bundlesize,ramchain->txbits,tlen,mbstr(str,total));
char str[65]; printf("alloc.[%d] txbits.%p[%d] total %s\n",ramchain->H.data->height/coin->chain->bundlesize,ramchain->txbits,tlen,mbstr(str,total));
return(tlen);
}
return(-1);
@ -133,12 +133,16 @@ int32_t iguana_alloccacheT(struct iguana_info *coin,struct iguana_ramchain *ramc
static int64_t total;
if ( ramchain->cacheT == 0 )
{
int32_t tlen; struct iguana_txid *T = (void *)((long)ramchain->H.data + ramchain->H.data->Toffset);
int32_t i,tlen; struct iguana_txid *T = (void *)((long)ramchain->H.data + ramchain->H.data->Toffset);
tlen = sizeof(*T) * ramchain->H.data->numtxids;
ramchain->cacheT = calloc(1,tlen);
memcpy(ramchain->cacheT,T,tlen);
if ( (ramchain->cacheT= calloc(1,tlen)) != 0 )
{
//memcpy(ramchain->cacheT,T,tlen);
for (i=0; i<ramchain->H.data->numtxids; i++)
ramchain->cacheT[i] = T[i];
} else ramchain->cacheT = T;
total += tlen;
//char str[65]; printf("alloc.[%d] cacheT.%p[%d] total %s\n",ramchain->H.data->height/coin->chain->bundlesize,ramchain->cacheT,tlen,mbstr(str,total));
char str[65]; printf("alloc.[%d] cacheT.%p[%d] total %s\n",ramchain->H.data->height/coin->chain->bundlesize,ramchain->cacheT,tlen,mbstr(str,total));
return(tlen);
}
return(-1);
@ -589,7 +593,7 @@ struct iguana_txid *iguana_txidfind(struct iguana_info *coin,int32_t *heightp,st
{
if ( (TXbits= ramchain->txbits) == 0 )
{
if ( coin->PREFETCHLAG >= 0 )
//if ( coin->PREFETCHLAG >= 0 )
iguana_alloctxbits(coin,ramchain);
if ( (TXbits= ramchain->txbits) == 0 )
{
@ -681,7 +685,7 @@ struct iguana_bundle *iguana_externalspent(struct iguana_info *coin,bits256 *pre
//printf("%s height.%d firstvout.%d prev.%d ->U%d\n",bits256_str(str,prev_hash),height,TX.firstvout,prev_vout,unspentind);
now = (uint32_t)time(NULL);
duration = (OS_milliseconds() - startmillis);
if ( 0 && ((uint64_t)coin->txidfind_num % 5000000) == 2000000 )
//if ( ((uint64_t)coin->txidfind_num % 10000) == 1 )
printf("%p iguana_txidfind.[%.0f] ave %.2f micros, total %.2f seconds | duration %.3f millis\n",spentbp->ramchain.txbits,coin->txidfind_num,(coin->txidfind_totalmillis*1000.)/coin->txidfind_num,coin->txidfind_totalmillis/1000.,duration);
coin->txidfind_totalmillis += duration;
coin->txidfind_num += 1.;
@ -808,7 +812,7 @@ struct iguana_pkhash *iguana_pkhashfind(struct iguana_info *coin,struct iguana_r
*depositsp = ACCTS[pkind].total;
*lastunspentindp = ACCTS[pkind].lastunspentind;
*p = P[pkind];
//printf("[%d] return pkind.%u %.8f last.%u ACCTS.%p %p\n",i,pkind,dstr(*depositsp),*lastunspentindp,ACCTS,ramchain->A);
printf("[%d] return pkind.%u %.8f last.%u ACCTS.%p %p\n",i,pkind,dstr(*depositsp),*lastunspentindp,ACCTS,ramchain->A);
return(p);
}
else if ( pkind != 0 )
@ -2196,6 +2200,7 @@ TWOSTRINGS_AND_INT(iguana,balance,activecoin,address,height)
memset(pubkey33,0,sizeof(pubkey33));
P = calloc(coin->bundlescount,sizeof(*P));
array = cJSON_CreateArray();
printf("Start %s balance.(%s) height.%d\n",coin->symbol,address,height);
if ( height == 0 )
height = (1 << 30);
iguana_pkhasharray(coin,array,minconf,maxconf,&total,P,coin->bundlescount,rmd160,address,pubkey33,height);

7
iguana/main.c

@ -434,8 +434,9 @@ void mainloop(struct supernet_info *myinfo)
n = coin->bundlescount-1;
if ( iguana_emitfinished(coin,1) >= n )
{
for (j=0; j<n; j++)
iguana_alloctxbits(coin,&coin->bundles[j]->ramchain);
//if ( coin->PREFETCHLAG >= 0 )
for (j=0; j<n; j++)
iguana_alloctxbits(coin,&coin->bundles[j]->ramchain);
if ( iguana_validated(coin) < n || iguana_utxofinished(coin) < n || iguana_balancefinished(coin) < n )
{
coin->spendvectorsaved = 1;
@ -1142,7 +1143,7 @@ void iguana_appletests(struct supernet_info *myinfo)
exit(-1);
}
sleep(1);*/
if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"prefetchlag\":13,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":500,\"endpend\":500,\"services\":128,\"maxpeers\":64,\"newcoin\":\"BTC\",\"active\":1,\"numhelpers\":4,\"poll\":1}"),0,myinfo->rpcport)) != 0 )
if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"prefetchlag\":-1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":500,\"endpend\":500,\"services\":128,\"maxpeers\":64,\"newcoin\":\"BTC\",\"active\":1,\"numhelpers\":4,\"poll\":1}"),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 )

Loading…
Cancel
Save