test
This commit is contained in:
@@ -90,8 +90,7 @@ char *curl_post(CURL **cHandlep,char *url,char *userpass,char *postfields,char *
|
|||||||
|
|
||||||
char *komodo_issuemethod(char *method,char *params)
|
char *komodo_issuemethod(char *method,char *params)
|
||||||
{
|
{
|
||||||
static void *cHandle; extern char USERPASS[1024]; extern uint16_t BITCOIND_PORT;
|
static void *cHandle; char url[512],*retstr=0,postdata[8192];
|
||||||
char url[512],*retstr=0,postdata[8192];
|
|
||||||
if ( params == 0 || params[0] == 0 )
|
if ( params == 0 || params[0] == 0 )
|
||||||
params = (char *)"[]";
|
params = (char *)"[]";
|
||||||
if ( strlen(params) < sizeof(postdata)-128 )
|
if ( strlen(params) < sizeof(postdata)-128 )
|
||||||
@@ -103,6 +102,7 @@ char *komodo_issuemethod(char *method,char *params)
|
|||||||
}
|
}
|
||||||
return(retstr);
|
return(retstr);
|
||||||
}
|
}
|
||||||
|
//curl --url "http://127.0.0.1:14555" --data "{\"method\":\"getinfo\",\"params\":[]}"
|
||||||
|
|
||||||
uint32_t komodo_txtime(uint256 hash)
|
uint32_t komodo_txtime(uint256 hash)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -949,15 +949,14 @@ char *parse_conf_line(char *line,char *field)
|
|||||||
line++;
|
line++;
|
||||||
while ( line[strlen(line)-1] == '\r' || line[strlen(line)-1] == '\n' || line[strlen(line)-1] == ' ' )
|
while ( line[strlen(line)-1] == '\r' || line[strlen(line)-1] == '\n' || line[strlen(line)-1] == ' ' )
|
||||||
line[strlen(line)-1] = 0;
|
line[strlen(line)-1] = 0;
|
||||||
printf("LINE.(%s)\n",line);
|
//printf("LINE.(%s)\n",line);
|
||||||
_stripwhite(line,0);
|
_stripwhite(line,0);
|
||||||
return(clonestr(line));
|
return(clonestr(line));
|
||||||
}
|
}
|
||||||
|
|
||||||
void komodo_configfile(char *symbol,uint16_t port)
|
void komodo_configfile(char *symbol,uint16_t port)
|
||||||
{
|
{
|
||||||
extern uint16_t BITCOIND_PORT;
|
FILE *fp; char fname[512],buf[128],line[4096],*str,*rpcuser,*rpcpassword,*rpcport;
|
||||||
FILE *fp; char fname[512],buf[128],line[4096],*str,*rpcuser,*rpcpassword,*rpcport,*retstr;
|
|
||||||
srand((uint32_t)time(NULL));
|
srand((uint32_t)time(NULL));
|
||||||
sprintf(buf,"%s.conf",symbol);
|
sprintf(buf,"%s.conf",symbol);
|
||||||
BITCOIND_PORT = port;
|
BITCOIND_PORT = port;
|
||||||
@@ -982,7 +981,7 @@ void komodo_configfile(char *symbol,uint16_t port)
|
|||||||
{
|
{
|
||||||
if ( line[0] == '#' )
|
if ( line[0] == '#' )
|
||||||
continue;
|
continue;
|
||||||
printf("line.(%s) %p %p\n",line,strstr(line,(char *)"rpcuser"),strstr(line,(char *)"rpcpassword"));
|
//printf("line.(%s) %p %p\n",line,strstr(line,(char *)"rpcuser"),strstr(line,(char *)"rpcpassword"));
|
||||||
if ( (str= strstr(line,(char *)"rpcuser")) != 0 )
|
if ( (str= strstr(line,(char *)"rpcuser")) != 0 )
|
||||||
rpcuser = parse_conf_line(str,(char *)"rpcuser");
|
rpcuser = parse_conf_line(str,(char *)"rpcuser");
|
||||||
else if ( (str= strstr(line,(char *)"rpcpassword")) != 0 )
|
else if ( (str= strstr(line,(char *)"rpcpassword")) != 0 )
|
||||||
@@ -1009,9 +1008,9 @@ void komodo_configfile(char *symbol,uint16_t port)
|
|||||||
free(rpcpassword);
|
free(rpcpassword);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
if ( (retstr= komodo_issuemethod((char *)"getinfo",0)) != 0 )
|
/*if ( (retstr= komodo_issuemethod((char *)"getinfo",0)) != 0 )
|
||||||
{
|
{
|
||||||
printf("GETINFO.%s (%s) USERPASS.%s\n",symbol,retstr,USERPASS);
|
printf("GETINFO.%s (%s) USERPASS.%s\n",symbol,retstr,USERPASS);
|
||||||
free(retstr);
|
free(retstr);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user