diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index e1d5398ed..65aca1bb3 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -184,9 +184,9 @@ forwardhex(pubkey,hex)\n\ return(LP_pubkey_trustset(jbits256(argjson,"pubkey"),jint(argjson,"trust"))); } if ( LP_isdisabled(base,rel) != 0 ) - retstr = clonestr("{\"error\":\"at least one of coins disabled\"}"); + retstr = clonestr("{\"result\":\"at least one of coins disabled\"}"); else if ( LP_isdisabled(jstr(argjson,"coin"),0) != 0 ) - retstr = clonestr("{\"error\":\"coin is disabled\"}"); + retstr = clonestr("{\"result\":\"coin is disabled\"}"); else if ( strcmp(method,"reserved") == 0 ) retstr = LP_quotereceived(argjson); else if ( strcmp(method,"connected") == 0 ) @@ -213,8 +213,8 @@ forwardhex(pubkey,hex)\n\ //printf("FORWARDED.(%s)\n",jprint(argjson,0)); if ( LP_forward(ctx,myipaddr,pubsock,profitmargin,jbits256(argjson,"pubkey"),jprint(reqjson,1),1) > 0 ) retstr = clonestr("{\"result\":\"success\"}"); - else retstr = clonestr("{\"error\":\"error forwarding\"}"); - } else retstr = clonestr("{\"error\":\"cant recurse forwards\"}"); + else retstr = clonestr("{\"result\":\"error forwarding\"}"); + } else retstr = clonestr("{\"result\":\"cant recurse forwards\"}"); } else if ( strcmp(method,"keepalive") == 0 ) @@ -231,7 +231,7 @@ forwardhex(pubkey,hex)\n\ { if ( LP_utxoaddjson(1,LP_mypubsock,argjson) != 0 ) return(clonestr("{\"result\":\"success\",\"notifyutxo\":\"received\"}")); - else return(clonestr("{\"error\":\"couldnt add utxo\"}")); + else return(clonestr("{\"result\":\"couldnt add utxo\"}")); } else if ( IAMLP != 0 ) { diff --git a/iguana/exchanges/LP_forwarding.c b/iguana/exchanges/LP_forwarding.c index cbde40d71..81706ccd8 100644 --- a/iguana/exchanges/LP_forwarding.c +++ b/iguana/exchanges/LP_forwarding.c @@ -42,10 +42,10 @@ struct LP_forwardinfo *LP_forwardfind(bits256 pubkey) char *LP_lookup(bits256 pubkey) { if ( bits256_nonz(pubkey) == 0 ) - return(clonestr("{\"error\":\"illegal pubkey\"}")); + return(clonestr("{\"result\":\"illegal pubkey\"}")); if ( LP_forwardfind(pubkey) != 0 ) return(clonestr("{\"result\":\"success\",\"forwarding\":1}")); - else return(clonestr("{\"error\":\"notfound\"}")); + else return(clonestr("{\"result\":\"notfound\"}")); } int32_t LP_hello(struct LP_forwardinfo *ptr) @@ -108,7 +108,7 @@ char *LP_register(bits256 pubkey,char *ipaddr,uint16_t port) { struct LP_forwardinfo *ptr=0; int32_t pushsock; char pushaddr[64]; if ( ipaddr == 0 || ipaddr[0] == 0 || is_ipaddr(ipaddr) == 0 || bits256_nonz(pubkey) == 0 ) - return(clonestr("{\"error\":\"illegal ipaddr or null pubkey\"}")); + return(clonestr("{\"result\":\"illegal ipaddr or null pubkey\"}")); nanomsg_transportname(0,pushaddr,ipaddr,port); char str[65]; printf("register.(%s) %s\n",pushaddr,bits256_str(str,pubkey)); if ( (ptr= LP_forwardfind(pubkey)) != 0 ) @@ -126,13 +126,13 @@ char *LP_register(bits256 pubkey,char *ipaddr,uint16_t port) char str[65]; printf("%u recreate pushsock for %s <- %s\n",(uint32_t)time(NULL),pushaddr,bits256_str(str,pubkey)); strcpy(ptr->pushaddr,pushaddr); if ( (ptr->pushsock= LP_pushsock_create(ptr,pushaddr)) < 0 ) - return(clonestr("{\"error\":\"couldnt recreate pushsock\",\"registered\":0}")); + return(clonestr("{\"result\":\"couldnt recreate pushsock\",\"registered\":0}")); } //else printf("no need to create identical endpoint\n"); } - return(clonestr("{\"error\":\"already registered\",\"registered\":1}")); + return(clonestr("{\"result\":\"already registered\",\"registered\":1}")); } else if ( (pushsock= LP_pushsock_create(0,pushaddr)) < 0 ) - return(clonestr("{\"error\":\"couldnt create pushsock\"}")); + return(clonestr("{\"result\":\"couldnt create pushsock\"}")); else { ptr = calloc(1,sizeof(*ptr)); @@ -216,7 +216,7 @@ char *LP_forwardhex(void *ctx,int32_t pubsock,bits256 pubkey,char *hexstr) { struct LP_forwardinfo *ptr=0; uint8_t *data; int32_t datalen=0,sentbytes=0; char *msg,*retstr=0; cJSON *retjson=0,*argjson=0,*reqjson=0; if ( hexstr == 0 || hexstr[0] == 0 ) - return(clonestr("{\"error\":\"nohex\"}")); + return(clonestr("{\"result\":\"nohex\"}")); datalen = (int32_t)strlen(hexstr) >> 1; data = malloc(datalen); decode_hex(data,datalen,hexstr); @@ -266,7 +266,7 @@ char *LP_forwardhex(void *ctx,int32_t pubsock,bits256 pubkey,char *hexstr) msg = jprint(reqjson,0); LP_send(pubsock,msg,(int32_t)strlen(msg)+1,1); } - retstr = clonestr("{\"error\":\"notfound\"}"); + retstr = clonestr("{\"result\":\"notfound\"}"); } free(data); if ( reqjson != 0 ) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index ee59204e5..59deb28e3 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -121,7 +121,7 @@ char *issue_LP_register(char *destip,uint16_t destport,bits256 pubkey,char *ipad sprintf(url,"http://%s:%u/api/stats/register?client=%s&pushaddr=%s&pushport=%u",destip,destport,bits256_str(str,pubkey),ipaddr,pushport); //return(LP_issue_curl("register",destip,destport,url)); retstr = issue_curlt(url,LP_HTTP_TIMEOUT*3); - printf("register.(%s) -> (%s)\n",url,retstr!=0?retstr:""); + //printf("register.(%s) -> (%s)\n",url,retstr!=0?retstr:""); return(retstr); } @@ -196,7 +196,7 @@ cJSON *bitcoin_json(struct iguana_info *coin,char *method,char *params) } //usleep(1000); //printf("dpow_gettxout.(%s)\n",retstr); - } else retjson = cJSON_Parse("{\"error\":\"disabled\"}"); + } else retjson = cJSON_Parse("{\"result\":\"disabled\"}"); } else printf("bitcoin_json cant talk to NULL coin\n"); return(retjson); }