This commit is contained in:
jl777
2016-10-29 08:36:43 -03:00
parent 0c365446d0
commit 0e1af8a8f8
2 changed files with 33 additions and 31 deletions

View File

@@ -112,19 +112,6 @@ bool AppInit(int argc, char* argv[])
fprintf(stderr, "Error: Invalid combination of -regtest and -testnet.\n"); fprintf(stderr, "Error: Invalid combination of -regtest and -testnet.\n");
return false; 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 // Command-line RPC
bool fCommandLine = false; bool fCommandLine = false;

View File

@@ -1285,25 +1285,40 @@ void komodo_configfile(char *symbol,uint16_t port)
void komodo_args() void komodo_args()
{ {
std::string name; std::string name; char *dirname; uint8_t buf[512]; int32_t i,len;
ASSETCHAINS_TIMESTAMP = GetArg("-ac_timestamp",ASSETCHAINS_TIMESTAMP); IS_KOMODO_NOTARY = GetBoolArg("-notary", false);
ASSETCHAINS_SUPPLY = GetArg("-ac_supply",10); NOTARY_PUBKEY = GetArg("-pubkey", "");
name = GetArg("-ac_name","REVS"); if ( strlen(NOTARY_PUBKEY.c_str()) == 66 )
strncpy(ASSETCHAINS_SYMBOL,name.c_str(),sizeof(ASSETCHAINS_SYMBOL)-1); USE_EXTERNAL_PUBKEY = 1;
uint8_t buf[512]; int32_t i,len; fprintf(stderr,"IS_KOMODO_NOTARY %d %s\n",IS_KOMODO_NOTARY,NOTARY_PUBKEY.c_str());
len = iguana_rwnum(1,buf,sizeof(ASSETCHAINS_TIMESTAMP),(void *)&ASSETCHAINS_TIMESTAMP); name = GetArg("-ac_name","");
len += iguana_rwnum(1,&buf[len],sizeof(ASSETCHAINS_SUPPLY),(void *)&ASSETCHAINS_SUPPLY); if ( name.c_str()[0] != 0 )
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; ASSETCHAINS_TIMESTAMP = GetArg("-ac_timestamp",ASSETCHAINS_TIMESTAMP);
for (i=0; ASSETCHAINS_SYMBOL[i+1]!=0; i++) ASSETCHAINS_SUPPLY = GetArg("-ac_supply",10);
ASSETCHAINS_SYMBOL[i] = ASSETCHAINS_SYMBOL[i+1]; strncpy(ASSETCHAINS_SYMBOL,name.c_str(),sizeof(ASSETCHAINS_SYMBOL)-1);
} len = iguana_rwnum(1,buf,sizeof(ASSETCHAINS_TIMESTAMP),(void *)&ASSETCHAINS_TIMESTAMP);
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); 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 ) while ( 0 && ASSETCHAIN_INIT == 0 )
{ {
sleep(1); sleep(1);