From 0e1af8a8f846f0d76c0f25038b3e1d140c30cd88 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 29 Oct 2016 08:36:43 -0300 Subject: [PATCH] test --- src/bitcoind.cpp | 13 ------------ src/komodo_utils.h | 51 ++++++++++++++++++++++++++++++---------------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index e5d2c7401..90e890ebd 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -112,19 +112,6 @@ bool AppInit(int argc, char* argv[]) fprintf(stderr, "Error: Invalid combination of -regtest and -testnet.\n"); return false; } - IS_KOMODO_NOTARY = GetBoolArg("-notary", false); - NOTARY_PUBKEY = GetArg("-pubkey", ""); - if ( strlen(NOTARY_PUBKEY.c_str()) == 66 ) - USE_EXTERNAL_PUBKEY = 1; - fprintf(stderr,"IS_KOMODO_NOTARY %d %s\n",IS_KOMODO_NOTARY,NOTARY_PUBKEY.c_str()); - char *dirname; - while ( (dirname= (char *)GetDataDir(false).string().c_str()) == 0 || dirname[0] == 0 ) - { - fprintf(stderr,"waiting for datadir\n"); - sleep(3); - } - fprintf(stderr,"Got datadir.(%s)\n",dirname); - komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1); // Command-line RPC bool fCommandLine = false; diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 1331b57c4..608646e2b 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1285,25 +1285,40 @@ void komodo_configfile(char *symbol,uint16_t port) void komodo_args() { - std::string name; - ASSETCHAINS_TIMESTAMP = GetArg("-ac_timestamp",ASSETCHAINS_TIMESTAMP); - ASSETCHAINS_SUPPLY = GetArg("-ac_supply",10); - name = GetArg("-ac_name","REVS"); - strncpy(ASSETCHAINS_SYMBOL,name.c_str(),sizeof(ASSETCHAINS_SYMBOL)-1); - uint8_t buf[512]; int32_t i,len; - len = iguana_rwnum(1,buf,sizeof(ASSETCHAINS_TIMESTAMP),(void *)&ASSETCHAINS_TIMESTAMP); - len += iguana_rwnum(1,&buf[len],sizeof(ASSETCHAINS_SUPPLY),(void *)&ASSETCHAINS_SUPPLY); - strcpy((char *)&buf[len],ASSETCHAINS_SYMBOL); - len += strlen(ASSETCHAINS_SYMBOL); - ASSETCHAINS_MAGIC = calc_crc32(0,buf,len); - ASSETCHAINS_PORT = GetArg("-ac_port",8000 + (ASSETCHAINS_MAGIC % 7777)); - if ( ASSETCHAINS_SYMBOL[0] == '-' ) + std::string name; char *dirname; uint8_t buf[512]; int32_t i,len; + IS_KOMODO_NOTARY = GetBoolArg("-notary", false); + NOTARY_PUBKEY = GetArg("-pubkey", ""); + if ( strlen(NOTARY_PUBKEY.c_str()) == 66 ) + USE_EXTERNAL_PUBKEY = 1; + fprintf(stderr,"IS_KOMODO_NOTARY %d %s\n",IS_KOMODO_NOTARY,NOTARY_PUBKEY.c_str()); + name = GetArg("-ac_name",""); + if ( name.c_str()[0] != 0 ) { - ASSETCHAINS_SHORTFLAG = 1; - for (i=0; ASSETCHAINS_SYMBOL[i+1]!=0; i++) - ASSETCHAINS_SYMBOL[i] = ASSETCHAINS_SYMBOL[i+1]; - } - fprintf(stderr,"after args: %c%s port.%u magic.%08x timestamp.%u supply.%u\n",ASSETCHAINS_SHORTFLAG!=0?'-':'+',ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_MAGIC,ASSETCHAINS_TIMESTAMP,(int32_t)ASSETCHAINS_SUPPLY); + ASSETCHAINS_TIMESTAMP = GetArg("-ac_timestamp",ASSETCHAINS_TIMESTAMP); + ASSETCHAINS_SUPPLY = GetArg("-ac_supply",10); + strncpy(ASSETCHAINS_SYMBOL,name.c_str(),sizeof(ASSETCHAINS_SYMBOL)-1); + len = iguana_rwnum(1,buf,sizeof(ASSETCHAINS_TIMESTAMP),(void *)&ASSETCHAINS_TIMESTAMP); + len += iguana_rwnum(1,&buf[len],sizeof(ASSETCHAINS_SUPPLY),(void *)&ASSETCHAINS_SUPPLY); + strcpy((char *)&buf[len],ASSETCHAINS_SYMBOL); + len += strlen(ASSETCHAINS_SYMBOL); + ASSETCHAINS_MAGIC = calc_crc32(0,buf,len); + ASSETCHAINS_PORT = GetArg("-ac_port",8000 + (ASSETCHAINS_MAGIC % 7777)); + if ( ASSETCHAINS_SYMBOL[0] == '-' ) + { + ASSETCHAINS_SHORTFLAG = 1; + for (i=0; ASSETCHAINS_SYMBOL[i+1]!=0; i++) + ASSETCHAINS_SYMBOL[i] = ASSETCHAINS_SYMBOL[i+1]; + } + fprintf(stderr,"after args: %c%s port.%u magic.%08x timestamp.%u supply.%u\n",ASSETCHAINS_SHORTFLAG!=0?'-':'+',ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_MAGIC,ASSETCHAINS_TIMESTAMP,(int32_t)ASSETCHAINS_SUPPLY); + while ( (dirname= (char *)GetDataDir(false).string().c_str()) == 0 || dirname[0] == 0 ) + { + fprintf(stderr,"waiting for datadir\n"); + sleep(3); + } + fprintf(stderr,"Got datadir.(%s)\n",dirname); + if ( ASSETCHAINS_SYMBOL[0] != 0 ) + komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1); + } while ( 0 && ASSETCHAIN_INIT == 0 ) { sleep(1);