Test
This commit is contained in:
@@ -196,7 +196,7 @@ try_again:
|
||||
|
||||
databuf = (char *)malloc(256 + strlen(command) + strlen(params));
|
||||
sprintf(databuf,"{\"id\":\"jl777\",\"method\":\"%s\",\"params\":%s%s%s}",command,bracket0,params,bracket1);
|
||||
printf("url.(%s) userpass.(%s) databuf.(%s)\n",url,userpass,databuf);
|
||||
//printf("url.(%s) userpass.(%s) databuf.(%s)\n",url,userpass,databuf);
|
||||
//
|
||||
} //else if ( specialcase != 0 ) fprintf(stderr,"databuf.(%s)\n",params);
|
||||
curl_easy_setopt(curl_handle,CURLOPT_POST,1L);
|
||||
@@ -339,7 +339,7 @@ char *komodo_issuemethod(char *userpass,char *method,char *params,uint16_t port)
|
||||
{
|
||||
sprintf(url,(char *)"http://127.0.0.1:%u",port);
|
||||
sprintf(postdata,"{\"method\":\"%s\",\"params\":%s}",method,params);
|
||||
printf("[%s] (%s) postdata.(%s) params.(%s) USERPASS.(%s)\n",ASSETCHAINS_SYMBOL,url,postdata,params,KMDUSERPASS);
|
||||
//printf("[%s] (%s) postdata.(%s) params.(%s) USERPASS.(%s)\n",ASSETCHAINS_SYMBOL,url,postdata,params,KMDUSERPASS);
|
||||
retstr2 = bitcoind_RPC(&retstr,(char *)"debug",url,userpass,method,params);
|
||||
//retstr = curl_post(&cHandle,url,USERPASS,postdata,0,0,0,0);
|
||||
}
|
||||
@@ -353,7 +353,7 @@ int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heig
|
||||
*kmdnotarized_heightp = 0;
|
||||
if ( strcmp(dest,"KMD") == 0 )
|
||||
{
|
||||
port = 7771;
|
||||
port = KMD_PORT;
|
||||
userpass = KMDUSERPASS;
|
||||
}
|
||||
else if ( strcmp(dest,"BTC") == 0 )
|
||||
@@ -435,7 +435,7 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t
|
||||
{
|
||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||
{
|
||||
jsonstr = komodo_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,7771);
|
||||
jsonstr = komodo_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,KMD_PORT);
|
||||
printf("userpass.(%s) got (%s)\n",KMDUSERPASS,jsonstr);
|
||||
}
|
||||
}//else jsonstr = _dex_getrawtransaction();
|
||||
|
||||
@@ -52,7 +52,7 @@ uint32_t ASSETCHAINS_MAGIC = 2387029918;
|
||||
uint64_t ASSETCHAINS_SUPPLY = 10;
|
||||
|
||||
uint32_t KOMODO_INITDONE;
|
||||
char KMDUSERPASS[4096],BTCUSERPASS[4096]; uint16_t BITCOIND_PORT = 7771;
|
||||
char KMDUSERPASS[4096],BTCUSERPASS[4096]; uint16_t KMD_PORT = 7771,BITCOIND_PORT = 7771;
|
||||
uint64_t PENDING_KOMODO_TX;
|
||||
|
||||
struct komodo_kv *KOMODO_KV;
|
||||
|
||||
@@ -1261,9 +1261,9 @@ void iguana_initQ(queue_t *Q,char *name)
|
||||
free(item);
|
||||
}
|
||||
|
||||
void komodo_userpass(char *username,char *password,FILE *fp)
|
||||
uint16_t komodo_userpass(char *username,char *password,FILE *fp)
|
||||
{
|
||||
char *rpcuser,*rpcpassword,*str,line[8192];
|
||||
char *rpcuser,*rpcpassword,*str,line[8192]; uint16_t port = 0;
|
||||
rpcuser = rpcpassword = 0;
|
||||
username[0] = password[0] = 0;
|
||||
while ( fgets(line,sizeof(line),fp) != 0 )
|
||||
@@ -1275,6 +1275,11 @@ void komodo_userpass(char *username,char *password,FILE *fp)
|
||||
rpcuser = parse_conf_line(str,(char *)"rpcuser");
|
||||
else if ( (str= strstr(line,(char *)"rpcpassword")) != 0 )
|
||||
rpcpassword = parse_conf_line(str,(char *)"rpcpassword");
|
||||
else if ( (str= strstr(line,(char *)"rpcport")) != 0 )
|
||||
{
|
||||
port = atoi(parse_conf_line(str,(char *)"rpcport"));
|
||||
printf("rpcport.%u in file\n",port);
|
||||
}
|
||||
}
|
||||
if ( rpcuser != 0 && rpcpassword != 0 )
|
||||
{
|
||||
@@ -1286,6 +1291,7 @@ void komodo_userpass(char *username,char *password,FILE *fp)
|
||||
free(rpcuser);
|
||||
if ( rpcpassword != 0 )
|
||||
free(rpcpassword);
|
||||
return(port);
|
||||
}
|
||||
|
||||
void komodo_statefname(char *fname,char *symbol,char *str)
|
||||
@@ -1328,7 +1334,7 @@ void komodo_statefname(char *fname,char *symbol,char *str)
|
||||
void komodo_configfile(char *symbol,uint16_t port)
|
||||
{
|
||||
static char myusername[512],mypassword[8192];
|
||||
FILE *fp; uint8_t buf2[33]; char fname[512],buf[128],username[512],password[8192]; uint32_t crc,r,r2,i;
|
||||
FILE *fp; uint16_t port; uint8_t buf2[33]; char fname[512],buf[128],username[512],password[8192]; uint32_t crc,r,r2,i;
|
||||
if ( symbol != 0 && port != 0 )
|
||||
{
|
||||
r = (uint32_t)time(NULL);
|
||||
@@ -1386,16 +1392,17 @@ void komodo_configfile(char *symbol,uint16_t port)
|
||||
#endif
|
||||
if ( (fp= fopen(fname,"rb")) != 0 )
|
||||
{
|
||||
komodo_userpass(username,password,fp);
|
||||
if ( (port= komodo_userpass(username,password,fp)) != 0 )
|
||||
KMD_PORT = port;
|
||||
sprintf(KMDUSERPASS,"%s:%s",username,password);
|
||||
fclose(fp);
|
||||
//printf("KOMODO.(%s) -> userpass.(%s)\n",fname,KMDUSERPASS);
|
||||
} else printf("couldnt open.(%s)\n",fname);
|
||||
}
|
||||
|
||||
int32_t komodo_userpass(char *userpass,char *symbol)
|
||||
uint16_t komodo_userpass(char *userpass,char *symbol)
|
||||
{
|
||||
FILE *fp; char fname[512],username[512],password[512],confname[16];
|
||||
FILE *fp; uint16_t port = 0; char fname[512],username[512],password[512],confname[16];
|
||||
userpass[0] = 0;
|
||||
if ( strcmp("KMD",symbol) == 0 )
|
||||
{
|
||||
@@ -1409,12 +1416,12 @@ int32_t komodo_userpass(char *userpass,char *symbol)
|
||||
komodo_statefname(fname,symbol,confname);
|
||||
if ( (fp= fopen(fname,"rb")) != 0 )
|
||||
{
|
||||
komodo_userpass(username,password,fp);
|
||||
port = komodo_userpass(username,password,fp);
|
||||
sprintf(userpass,"%s:%s",username,password);
|
||||
fclose(fp);
|
||||
return((int32_t)strlen(userpass));
|
||||
}
|
||||
return(-1);
|
||||
return(port);
|
||||
}
|
||||
|
||||
uint32_t komodo_assetmagic(char *symbol,uint64_t supply)
|
||||
|
||||
Reference in New Issue
Block a user