From f3fa5ed82357d224d00e7156798f15065a0ece92 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 22 Mar 2016 16:53:14 -0300 Subject: [PATCH] test --- iguana/iguana777.c | 1 + iguana/iguana_init.c | 6 +++--- iguana/main.c | 18 ++++++++++++------ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/iguana/iguana777.c b/iguana/iguana777.c index fb9436135..c6a10fb7f 100755 --- a/iguana/iguana777.c +++ b/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); } diff --git a/iguana/iguana_init.c b/iguana/iguana_init.c index 0b80469de..9d00881e0 100755 --- a/iguana/iguana_init.c +++ b/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]); diff --git a/iguana/main.c b/iguana/main.c index 686a7defc..29e3f12d6 100755 --- a/iguana/main.c +++ b/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 ) {