test
This commit is contained in:
@@ -348,7 +348,7 @@ char *komodo_issuemethod(char *userpass,char *method,char *params,uint16_t port)
|
|||||||
|
|
||||||
uint256 komodo_getblockhash(int32_t height)
|
uint256 komodo_getblockhash(int32_t height)
|
||||||
{
|
{
|
||||||
uint256 hash; char params[128],*hexstr,*jsonstr; cJSON *result;
|
uint256 hash; char params[128],*hexstr,*jsonstr; cJSON *result; uint8_t revbuf[32];
|
||||||
memset(&hash,0,sizeof(hash));
|
memset(&hash,0,sizeof(hash));
|
||||||
sprintf(params,"[%d]",height);
|
sprintf(params,"[%d]",height);
|
||||||
if ( (jsonstr= komodo_issuemethod(KMDUSERPASS,(char *)"getblockhash",params,7771)) != 0 )
|
if ( (jsonstr= komodo_issuemethod(KMDUSERPASS,(char *)"getblockhash",params,7771)) != 0 )
|
||||||
@@ -358,7 +358,11 @@ uint256 komodo_getblockhash(int32_t height)
|
|||||||
if ( (hexstr= jstr(result,(char *)"result")) != 0 )
|
if ( (hexstr= jstr(result,(char *)"result")) != 0 )
|
||||||
{
|
{
|
||||||
if ( is_hexstr(hexstr,0) == 64 )
|
if ( is_hexstr(hexstr,0) == 64 )
|
||||||
decode_hex((uint8_t *)&hash,32,hexstr);
|
{
|
||||||
|
decode_hex(revbuf,32,hexstr);
|
||||||
|
for (i=0; i<32; i++)
|
||||||
|
((uint8_t *)&hash)[i] = revbuf[31-i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
free_json(result);
|
free_json(result);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user