test
This commit is contained in:
@@ -62,13 +62,15 @@ void komodo_gateway_tx(int32_t height,int32_t txi,char *txidstr,uint32_t port)
|
|||||||
|
|
||||||
void komodo_gateway_block(int32_t height,uint16_t port)
|
void komodo_gateway_block(int32_t height,uint16_t port)
|
||||||
{
|
{
|
||||||
char *retstr,*retstr2,params[128]; int32_t i,n; cJSON *json,*tx;
|
char *retstr,*retstr2,params[128],*txidstr; int32_t i,n; cJSON *json,*tx,*result;
|
||||||
sprintf(params,"[%d]",height);
|
sprintf(params,"[%d]",height);
|
||||||
if ( (retstr= komodo_issuemethod((char *)"getblockhash",params,port)) != 0 )
|
if ( (retstr= komodo_issuemethod((char *)"getblockhash",params,port)) != 0 )
|
||||||
{
|
{
|
||||||
if ( strlen(retstr) == 64 )
|
if ( (result= cJSON_Parse(retstr)) != 0 )
|
||||||
{
|
{
|
||||||
sprintf(params,"[\"%s\"]",retstr);
|
if ( (txidstr= jstr(result,"result")) != 0 && strlen(txidstr) == 64 )
|
||||||
|
{
|
||||||
|
sprintf(params,"[\"%s\"]",txidstr);
|
||||||
if ( (retstr2= komodo_issuemethod((char *)"getblock",params,port)) != 0 )
|
if ( (retstr2= komodo_issuemethod((char *)"getblock",params,port)) != 0 )
|
||||||
{
|
{
|
||||||
printf("getblock.(%s)\n",retstr2);
|
printf("getblock.(%s)\n",retstr2);
|
||||||
@@ -83,7 +85,9 @@ void komodo_gateway_block(int32_t height,uint16_t port)
|
|||||||
}
|
}
|
||||||
free(retstr2);
|
free(retstr2);
|
||||||
}
|
}
|
||||||
} else printf("strlen.%ld (%s)\n",strlen(retstr),retstr);
|
} else printf("strlen.%ld (%s)\n",strlen(txidstr),txidstr);
|
||||||
|
free_json(result);
|
||||||
|
}
|
||||||
free(retstr);
|
free(retstr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user