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));
sprintf(params,"[%d]",height);
if ( (jsonstr= komodo_issuemethod(KMDUSERPASS,(char *)"getblockhash",params,7771)) != 0 )
if ( (hexstr= jstr(result,(char *)"result")) != 0 )
{
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);
}