Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
e79bdb2d96
  1. 2
      iguana/btc
  2. 1
      iguana/iguana777.c
  3. 2
      iguana/iguana777.h
  4. 21
      iguana/iguana_blocks.c
  5. 2
      iguana/iguana_bundles.c
  6. 6
      iguana/iguana_json.c
  7. 4
      iguana/iguana_ramchain.c
  8. 4
      iguana/main.c
  9. 2
      prices/prices777.c

2
iguana/btc

@ -0,0 +1,2 @@
mkdir /tmp/BTC
curl --url "http://127.0.0.1:7778" --data "{\"prefetchlag\":15,\"poll\":1,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"newcoin\":\"BTC\",\"startpend\":8,\"endpend\":1,\"services\":0,\"maxpeers\":64}"

1
iguana/iguana777.c

@ -661,6 +661,7 @@ struct iguana_info *iguana_setcoin(char *symbol,void *launched,int32_t maxpeers,
struct iguana_chain *iguana_createchain(cJSON *json);
struct iguana_info *coin; int32_t j,m,mult,maxval,mapflags; char dirname[512],*prefix; cJSON *peers;
mapflags = IGUANA_MAPRECVDATA | maphash*IGUANA_MAPTXIDITEMS | maphash*IGUANA_MAPPKITEMS | maphash*IGUANA_MAPBLOCKITEMS | maphash*IGUANA_MAPPEERITEMS;
printf("setcoin.%s\n",symbol);
coin = iguana_coinadd(symbol,json);
coin->launched = launched;
if ( (coin->MAXPEERS= maxpeers) <= 0 )

2
iguana/iguana777.h

@ -494,7 +494,7 @@ struct iguana_info
//struct scriptinfo *scriptstable[2];
struct iguana_bundle *bundles[IGUANA_MAXBUNDLES],*current,*lastpending;
struct iguana_ramchain RTramchain; struct OS_memspace RTmem,RThashmem; bits256 RThash1;
int32_t numremain,numpendings,zcount,recvcount,bcount,pcount,lastbundle,numsaved,pendbalances,numverified;
int32_t numremain,numpendings,zcount,recvcount,bcount,pcount,lastbundle,numsaved,pendbalances,numverified,blockdepth;
uint32_t recvtime,hdrstime,backstoptime,lastbundletime,numreqsent,numbundlesQ,lastbundleitime,lastdisp,RTgenesis,RTstarti,idletime,stucktime,stuckmonitor,maxstuck,lastreqtime,RThdrstime;
double bandwidth,maxbandwidth,backstopmillis; bits256 backstophash2; int64_t spaceused;
int32_t initialheight,mapflags,minconfirms,numrecv,bindsock,isRT,backstop,blocksrecv,merging,polltimeout,numreqtxids,allhashes; bits256 reqtxids[64];

21
iguana/iguana_blocks.c

@ -70,30 +70,29 @@ void _iguana_blocklink(struct iguana_info *coin,struct iguana_block *prev,struct
struct iguana_block *iguana_blockhashset(char *debugstr,struct iguana_info *coin,int32_t height,bits256 hash2,int32_t createflag)
{
static int depth;
struct iguana_block *block,*prev;
if ( height > 0 && height > coin->blocks.maxbits )
{
printf("%s: illegal height.%d when max.%d, or nonz depth.%d\n",debugstr,height,coin->blocks.maxbits,depth);
printf("%s: illegal height.%d when max.%d, or nonz depth.%d\n",debugstr,height,coin->blocks.maxbits,coin->blockdepth);
//getchar();
return(0);
}
while ( depth != 0 )
while ( coin->blockdepth != 0 )
{
sleep(1);
printf("%s >>>>>>>>>> OK only if rare %s blockhashset.%d depth.%d\n",coin->symbol,debugstr,height,depth);
printf("%s >>>>>>>>>> OK only if rare %s blockhashset.%d depth.%d\n",coin->symbol,debugstr,height,coin->blockdepth);
//fprintf(stderr,">>>>>>>>>> OK only if rare %s blockhashset.%d depth.%d\n",debugstr,height,depth);
//printf("%d\n",1/(1 - depth/depth));
}
depth++;
coin->blockdepth++;
HASH_FIND(hh,coin->blocks.hash,&hash2,sizeof(hash2),block);
if ( block != 0 )
{
depth--;
while ( depth != 0 )
coin->blockdepth--;
while ( coin->blockdepth != 0 )
{
sleep(1);
printf(" %s >>>>>>>>>> OK only if rare %s match blockhashset.%d depth.%d\n",coin->symbol,debugstr,height,depth);
printf(" %s >>>>>>>>>> OK only if rare %s match blockhashset.%d depth.%d\n",coin->symbol,debugstr,height,coin->blockdepth);
//fprintf(stderr,">>>>>>>>>> OK only if rare%s match blockhashset.%d depth.%d\n",debugstr,height,depth);
//printf("%d\n",1/(1 - depth/depth));
}
@ -125,11 +124,11 @@ struct iguana_block *iguana_blockhashset(char *debugstr,struct iguana_info *coin
}
portable_mutex_unlock(&coin->blocks_mutex);
}
depth--;
while ( depth != 0 )
coin->blockdepth--;
while ( coin->blockdepth != 0 )
{
sleep(1);
printf("%s >>>>>>>>>> OK only if rare %s create blockhashset.%d depth.%d\n",coin->symbol,debugstr,height,depth);
printf("%s >>>>>>>>>> OK only if rare %s create blockhashset.%d depth.%d\n",coin->symbol,debugstr,height,coin->blockdepth);
//fprintf(stderr,">>>>>>>>>> OK only if rare%s create blockhashset.%d depth.%d\n",debugstr,height,depth);
//printf("%d\n",1/(1 - depth/depth));
}

2
iguana/iguana_bundles.c

@ -936,7 +936,7 @@ int32_t iguana_bundlefinalize(struct iguana_info *coin,struct iguana_bundle *bp,
/*if ( bp->hdrsi == 0 && iguana_peerblockrequest(coin,coin->blockspace,sizeof(coin->blockspace),0,bp->hashes[0],1) > 0 )
printf("GENESIS block validated\n");
else printf("GENESIS didnt validate bp.%p\n",bp);*/
iguana_bundlevalidate(coin,bp,1);
//iguana_bundlevalidate(coin,bp,1);
}
else
{

6
iguana/iguana_json.c

@ -600,10 +600,10 @@ STRING_ARG(iguana,addcoin,newcoin)
symbol = coin->symbol;
if ( symbol != 0 )
{
//printf(">> addcoin.%s\n",symbol);
printf(">> addcoin.%s\n",symbol);
#ifdef __PNACL__
if ( strcmp(symbol,"BTC") == 0 )
return(clonestr("{\"result\":\"BTC for chrome app is not yet\"}"));
// if ( strcmp(symbol,"BTC") == 0 )
// return(clonestr("{\"result\":\"BTC for chrome app is not yet\"}"));
#endif
if ( (retval= iguana_launchcoin(symbol,json)) > 0 )
{

4
iguana/iguana_ramchain.c

@ -2195,7 +2195,7 @@ struct iguana_ramchain *iguana_bundleload(struct iguana_info *coin,struct iguana
if ( (mapchain= iguana_ramchain_map(coin,fname,bp,bp->n,ramchain,0,0,bp->hashes[0],zero,0,0,extraflag,1)) != 0 )
{
iguana_ramchain_link(mapchain,bp->hashes[0],bp->hdrsi,bp->bundleheight,0,bp->n,firsti,1);
//char str[65]; printf("bp.%d: T.%d U.%d S.%d P%d X.%d MAPPED %s %p\n",bp->hdrsi,mapchain->H.data->numtxids,mapchain->H.data->numunspents,mapchain->H.data->numspends,mapchain->H.data->numpkinds,mapchain->H.data->numexternaltxids,mbstr(str,mapchain->H.data->allocsize),mapchain->H.data);
char str[65]; printf("bp.%d: T.%d U.%d S.%d P%d X.%d MAPPED %s %p\n",bp->hdrsi,mapchain->H.data->numtxids,mapchain->H.data->numunspents,mapchain->H.data->numspends,mapchain->H.data->numpkinds,mapchain->H.data->numexternaltxids,mbstr(str,mapchain->H.data->allocsize),mapchain->H.data);
//ramcoder_test(mapchain->H.data,mapchain->H.data->allocsize);
B = (void *)(long)((long)mapchain->H.data + mapchain->H.data->Boffset);
T = (void *)(long)((long)mapchain->H.data + mapchain->H.data->Toffset);
@ -2235,7 +2235,7 @@ struct iguana_ramchain *iguana_bundleload(struct iguana_info *coin,struct iguana
}
else
{
//printf("couldnt load bundle.%d\n",bp->bundleheight);
printf("couldnt load bundle.%d\n",bp->bundleheight);
memset(&bp->ramchain,0,sizeof(bp->ramchain));
}
if ( mapchain != 0 )

4
iguana/main.c

@ -1126,13 +1126,13 @@ void iguana_appletests(struct supernet_info *myinfo)
//iguana_chaingenesis(genesisblock,"sha256",1,1317972665,0x1e0ffff0,2084524493,bits256_conv("97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9")); // LTC
if ( 1 )
{
btcd = iguana_coinadd("BTCD",0);
/*btcd = iguana_coinadd("BTCD",0);
if ( btcd == 0 )
{
printf("error adding BTCD.%p\n",btcd);
exit(-1);
}
sleep(1);
sleep(1);*/
if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"VALIDATE\":1,\"prefetchlag\":13,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":2048,\"endpend\":1,\"services\":0,\"maxpeers\":64,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":4,\"poll\":1}"),0,myinfo->rpcport)) != 0 )
{
free(str);

2
prices/prices777.c

@ -1011,7 +1011,7 @@ int32_t prices777_init(char *jsonstr,int32_t peggyflag)
{
exchangeptr = &Exchanges[i];
if ( (exchangeptr->refcount > 0 || strcmp(exchangeptr->name,"unconf") == 0) )//&& strcmp(exchangeptr->name,"pangea") != 0 && strcmp(exchangeptr->name,"jumblr") != 0 )
iguana_launch(iguana_coinadd("BTCD"),"exchangeloop",(void *)prices777_exchangeloop,exchangeptr,IGUANA_EXCHANGETHREAD);
iguana_launch(0,"exchangeloop",(void *)prices777_exchangeloop,exchangeptr,IGUANA_EXCHANGETHREAD);
}
return(0);
}

Loading…
Cancel
Save