test
This commit is contained in:
@@ -348,13 +348,20 @@ char *komodo_issuemethod(char *userpass,char *method,char *params,uint16_t port)
|
||||
|
||||
uint256 komodo_getblockhash(int32_t height)
|
||||
{
|
||||
uint256 hash; char params[128],*hexstr;
|
||||
uint256 hash; char params[128],*hexstr,*jsonstr;
|
||||
memset(&hash,0,sizeof(hash));
|
||||
sprintf(params,"[%d]",height);
|
||||
if ( (hexstr= komodo_issuemethod(KMDUSERPASS,(char *)"getblockhash",params,7771)) != 0 )
|
||||
if ( (jsonstr= komodo_issuemethod(KMDUSERPASS,(char *)"getblockhash",params,7771)) != 0 )
|
||||
{
|
||||
if ( is_hexstr(hexstr,0) == 64 )
|
||||
decode_hex((uint8_t *)&hash,32,hexstr);
|
||||
if ( (result= cJSON_Parse(jsonstr)) != 0 )
|
||||
{
|
||||
if ( (hexstr= jstr(result,"result")) != 0 )
|
||||
{
|
||||
if ( is_hexstr(hexstr,0) == 64 )
|
||||
decode_hex((uint8_t *)&hash,32,hexstr);
|
||||
}
|
||||
free_json(result);
|
||||
}
|
||||
printf("KMD hash.%d (%s)\n",height,hexstr);
|
||||
free(hexstr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user