Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
f3fa5ed823
  1. 1
      iguana/iguana777.c
  2. 6
      iguana/iguana_init.c
  3. 18
      iguana/main.c

1
iguana/iguana777.c

@ -74,6 +74,7 @@ struct iguana_info *iguana_coinadd(const char *symbol,cJSON *argjson)
coin->chain = iguana_chainfind((char *)symbol,argjson,1);
strcpy(coin->symbol,symbol);
iguana_initcoin(coin,argjson);
printf("coin.%s initialized\n",symbol);
}
return(coin);
}

6
iguana/iguana_init.c

@ -52,9 +52,9 @@ void iguana_initpeer(struct iguana_info *coin,struct iguana_peer *addr,uint64_t
void iguana_initcoin(struct iguana_info *coin,cJSON *argjson)
{
int32_t i;
//sprintf(dirname,"%s/%s",GLOBALTMPDIR,coin->symbol), OS_portable_path(dirname);
//OS_portable_rmdir(dirname,0);
int32_t i; char dirname[1024];
sprintf(dirname,"%s/%s",GLOBALTMPDIR,coin->symbol), OS_portable_path(dirname);
sprintf(dirname,"tmp/%s",coin->symbol), OS_portable_path(dirname);
portable_mutex_init(&coin->peers_mutex);
portable_mutex_init(&coin->blocks_mutex);
portable_mutex_init(&coin->scripts_mutex[0]);

18
iguana/main.c

@ -1022,7 +1022,7 @@ int maingen(int argc, char** argv)
void iguana_main(void *arg)
{
cJSON *argjson; int32_t usessl = 0, ismainnet = 1; int32_t i;
cJSON *argjson; int32_t usessl = 0, ismainnet = 1; int32_t i; struct iguana_info *btc,*btcd;
struct supernet_info *myinfo; char *tmpstr,*helperargs,*coinargs,helperstr[512];
mycalloc(0,0,0);
myinfo = SuperNET_MYINFO(0);
@ -1094,8 +1094,13 @@ void iguana_main(void *arg)
OS_ensure_directory("tmp");
OS_ensure_directory("purgeable");
OS_ensure_directory(GLOBALTMPDIR);
iguana_coinadd("BTC",0);
iguana_coinadd("BTCD",0);
btc = iguana_coinadd("BTC",0);
btcd = iguana_coinadd("BTCD",0);
if ( btc == 0 || btcd == 0 )
{
printf("error adding BTC.%p or BTCD.%p\n",btc,btcd);
exit(-1);
}
if ( (tmpstr= SuperNET_JSON(myinfo,cJSON_Parse("{\"agent\":\"SuperNET\",\"method\":\"help\"}"),0)) != 0 )
{
if ( (API_json= cJSON_Parse(tmpstr)) != 0 && (API_json= jobj(API_json,"result")) != 0 )
@ -1108,12 +1113,13 @@ void iguana_main(void *arg)
{
sprintf(helperstr,"{\"name\":\"%d\"}",i);
helperargs = clonestr(helperstr);
iguana_launch(iguana_coinadd("BTCD",0),"iguana_helper",iguana_helper,helperargs,IGUANA_PERMTHREAD);
iguana_launch(btcd,"iguana_helper",iguana_helper,helperargs,IGUANA_PERMTHREAD);
free(helperstr);
}
iguana_launch(iguana_coinadd("BTCD",0),"rpcloop",iguana_rpcloop,SuperNET_MYINFO(0),IGUANA_PERMTHREAD);
iguana_launch(btcd,"rpcloop",iguana_rpcloop,SuperNET_MYINFO(0),IGUANA_PERMTHREAD);
category_init(&MYINFO);
if ( (coinargs= SuperNET_keysinit(&MYINFO,arg)) != 0 )
iguana_launch(iguana_coinadd("BTCD",0),"iguana_coins",iguana_coins,coinargs,IGUANA_PERMTHREAD);
iguana_launch(btcd,"iguana_coins",iguana_coins,coinargs,IGUANA_PERMTHREAD);
#ifdef __APPLE__
else if ( 1 )
{

Loading…
Cancel
Save