Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
bb1ee9fc4b
  1. 4
      gecko/gecko_blocks.c
  2. 28
      iguana/iguana_rpc.c
  3. 6
      iguana/main.c

4
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);

28
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<n; i++)
{
argjson = jitem(origargjson,i);
//printf("after urlconv.(%s) argjson.(%s)\n",jprint(json,0),jprint(argjson,0));
if ( (retstr= SuperNET_JSON(myinfo,argjson,remoteaddr,port)) != 0 )
{
if ( (retitem= cJSON_Parse(retstr)) != 0 )
jaddi(retarray,retitem);
free(retstr);
}
//printf("(%s) {%s} -> (%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;

6
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 )

Loading…
Cancel
Save