From bb1ee9fc4bd4a5a6a7aa9f1e41239f308cf367df Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 21 Jun 2016 07:03:49 -0300 Subject: [PATCH] test --- gecko/gecko_blocks.c | 4 +++- iguana/iguana_rpc.c | 28 +++++++++++++++++----------- iguana/main.c | 6 +++++- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/gecko/gecko_blocks.c b/gecko/gecko_blocks.c index d023cfff5..500a0e844 100755 --- a/gecko/gecko_blocks.c +++ b/gecko/gecko_blocks.c @@ -290,8 +290,10 @@ int32_t basilisk_blocksubmit(struct supernet_info *myinfo,struct iguana_info *bt valsobj = cJSON_CreateObject(); jaddnum(valsobj,"fanout",-1); jaddstr(valsobj,"symbol",virt->symbol); - if ( (str2= basilisk_standardservice("BLK",myinfo,hash2,valsobj,blockstr,0)) != 0 ) + if ( (str2= basilisk_standardservice("BLK",myinfo,hash2,valsobj,blockstr,1)) != 0 ) + { free(str2); + } free_json(valsobj); } free_json(retjson); diff --git a/iguana/iguana_rpc.c b/iguana/iguana_rpc.c index 4dff170c2..5f294ca00 100755 --- a/iguana/iguana_rpc.c +++ b/iguana/iguana_rpc.c @@ -1007,19 +1007,25 @@ char *SuperNET_rpcparse(struct supernet_info *myinfo,char *retbuf,int32_t bufsiz } } } - origargjson = argjson; - if ( is_cJSON_Array(argjson) != 0 && cJSON_GetArraySize(argjson) == 1 ) - argjson = jitem(argjson,0); - //printf("after urlconv.(%s) argjson.(%s)\n",jprint(json,0),jprint(argjson,0)); - if ( jstr(argjson,"method") == 0 ) + if ( is_cJSON_Array(argjson) != 0 && (n= cJSON_GetArraySize(argjson)) > 0 ) { - printf("no method in request.(%s)\n",jprint(argjson,0)); + cJSON *retitem,*retarray = cJSON_CreateArray(); + origargjson = argjson; + for (i=0; i (%s) postflag.%d (%s)\n",urlstr,jprint(argjson,0),cJSON_Print(json),*postflagp,retstr); + } free_json(origargjson); - return(0); - } - retstr = SuperNET_JSON(myinfo,argjson,remoteaddr,port); - //printf("(%s) {%s} -> (%s) postflag.%d (%s)\n",urlstr,jprint(argjson,0),cJSON_Print(json),*postflagp,retstr); - free_json(origargjson); + retstr = jprint(retarray,1); + } else retstr = SuperNET_JSON(myinfo,argjson,remoteaddr,port); return(retstr); } *jsonflagp = 1; diff --git a/iguana/main.c b/iguana/main.c index 5ddc63b5f..5e8975941 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -287,7 +287,11 @@ char *SuperNET_JSON(struct supernet_info *myinfo,cJSON *json,char *remoteaddr,ui remoteaddr = 0; if ( (agent = jstr(json,"agent")) == 0 ) agent = "bitcoinrpc"; - method = jstr(json,"method"); + if ( (method= jstr(json,"method")) == 0 ) + { + printf("no method in request.(%s)\n",jprint(json,0)); + return(clonestr("{\"error\":\"no method\"}")); + } if ( remoteaddr == 0 ) { if ( jobj(json,"timestamp") != 0 )