diff --git a/basilisk/basilisk_MSG.c b/basilisk/basilisk_MSG.c index 0390f3ee6..97b6f02ce 100755 --- a/basilisk/basilisk_MSG.c +++ b/basilisk/basilisk_MSG.c @@ -171,7 +171,7 @@ HASH_ARRAY_STRING(basilisk,sendmessage,hash,vals,hexstr) int32_t basilisk_channelsend(struct supernet_info *myinfo,bits256 hash,uint32_t channel,uint32_t msgid,uint8_t *data,int32_t datalen) { - char *retstr,*hexstr,strbuf[16384],*ptr = 0; int32_t retval = -1; cJSON *retjson,*valsobj; + char *retstr,*hexstr,strbuf[16384],*ptr = 0; int32_t retval = -1; cJSON *retarray,*item,*valsobj; if ( (hexstr= basilisk_addhexstr(&ptr,0,strbuf,sizeof(strbuf),data,datalen)) != 0 ) { valsobj = cJSON_CreateObject(); @@ -179,11 +179,14 @@ int32_t basilisk_channelsend(struct supernet_info *myinfo,bits256 hash,uint32_t jaddnum(valsobj,"msgid",msgid); if ( (retstr= basilisk_sendmessage(myinfo,0,0,0,hash,valsobj,hexstr)) != 0 ) { - if ( (retjson= cJSON_Parse(retstr)) != 0 ) + if ( (retarray= cJSON_Parse(retstr)) != 0 ) { - if ( jobj(retjson,"error") == 0 ) + if ( is_cJSON_Array(retarray) != 0 ) + item = jitem(retarray,0); + else item = retarray; + if ( jobj(item,"error") == 0 ) retval = 0; - free_json(retjson); + free_json(retarray); } free(retstr); } diff --git a/iguana/tests/request b/iguana/tests/request index 154968b00..de17631b8 100755 --- a/iguana/tests/request +++ b/iguana/tests/request @@ -1,2 +1,2 @@ -curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"InstantDEX\",\"method\":\"request\",\"vals\":{\"source\":\"BTCD\",\"amount\":1,\"dest\":\"BTC\",\"minprice\":0.0025,\"autoflag\":1}}" +curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"InstantDEX\",\"method\":\"request\",\"vals\":{\"source\":\"BTCD\",\"amount\":1,\"dest\":\"BTC\",\"minprice\":0.0025}}"