Browse Source

Test

etomic
jl777 7 years ago
parent
commit
4d13ab5c13
  1. 18
      iguana/exchanges/LP_rpc.c
  2. 2
      iguana/exchanges/LP_socket.c

18
iguana/exchanges/LP_rpc.c

@ -105,25 +105,21 @@ char *issue_LP_getprices(char *destip,uint16_t destport)
char *LP_apicall(struct iguana_info *coin,char *method,char *params) char *LP_apicall(struct iguana_info *coin,char *method,char *params)
{ {
cJSON *retjson,*resultjson; char *retstr; cJSON *retjson; char *retstr;
if ( coin->electrum != 0 ) if ( coin->electrum != 0 )
{ {
if ( (retjson= electrum_submit(coin->symbol,coin->electrum,&retjson,method,params,LP_HTTP_TIMEOUT)) != 0 ) if ( (retjson= electrum_submit(coin->symbol,coin->electrum,&retjson,method,params,LP_HTTP_TIMEOUT)) != 0 )
{ {
printf("got.%p (%s)\n",retjson,jprint(retjson,0)); retstr = jprint(retjson,0);
if ( (resultjson= jobj(retjson,"result")) != 0 ) //printf("got.%p (%s)\n",retjson,retstr);
{ return(retstr);
retstr = jprint(resultjson,0);
free_json(retjson);
return(retstr);
} else return(jprint(retjson,1));
} return(clonestr("{\"error\":\"electrum no response\"}")); } return(clonestr("{\"error\":\"electrum no response\"}"));
} else return(bitcoind_passthru(coin->symbol,coin->serverport,coin->userpass,method,params)); } else return(bitcoind_passthru(coin->symbol,coin->serverport,coin->userpass,method,params));
} }
cJSON *bitcoin_json(struct iguana_info *coin,char *method,char *params) cJSON *bitcoin_json(struct iguana_info *coin,char *method,char *params)
{ {
cJSON *resultjson,*retjson = 0; char *retstr; cJSON *retjson = 0; char *retstr;
// "getinfo", "getrawmempool", "paxprice", "gettxout", "getrawtransaction", "getblock", "listunspent", "listtransactions", "validateaddress", "importprivkey" // "getinfo", "getrawmempool", "paxprice", "gettxout", "getrawtransaction", "getblock", "listunspent", "listtransactions", "validateaddress", "importprivkey"
// bitcoind_passthru callers: "importaddress", "estimatefee", "getblockhash", "sendrawtransaction", "signrawtransaction" // bitcoind_passthru callers: "importaddress", "estimatefee", "getblockhash", "sendrawtransaction", "signrawtransaction"
if ( coin != 0 ) if ( coin != 0 )
@ -146,12 +142,12 @@ cJSON *bitcoin_json(struct iguana_info *coin,char *method,char *params)
if ( (retjson= electrum_submit(coin->symbol,coin->electrum,&retjson,method,params,LP_HTTP_TIMEOUT)) != 0 ) if ( (retjson= electrum_submit(coin->symbol,coin->electrum,&retjson,method,params,LP_HTTP_TIMEOUT)) != 0 )
{ {
//printf("electrum %s.%s -> (%s)\n",method,params,jprint(retjson,0)); //printf("electrum %s.%s -> (%s)\n",method,params,jprint(retjson,0));
if ( (resultjson= jobj(retjson,"result")) != 0 ) /*if ( (resultjson= jobj(retjson,"result")) != 0 )
{ {
resultjson = jduplicate(resultjson); resultjson = jduplicate(resultjson);
free_json(retjson); free_json(retjson);
retjson = resultjson; retjson = resultjson;
} }*/
} }
} }
} else retjson = cJSON_Parse("{\"result\":\"disabled\"}"); } else retjson = cJSON_Parse("{\"result\":\"disabled\"}");

2
iguana/exchanges/LP_socket.c

@ -523,7 +523,7 @@ int32_t LP_recvfunc(struct electrum_info *ep,char *str,int32_t len)
if ( (strjson= cJSON_Parse(str)) != 0 ) if ( (strjson= cJSON_Parse(str)) != 0 )
{ {
resultjson = jobj(strjson,"result"); resultjson = jobj(strjson,"result");
printf("result.(%s)\n",jprint(resultjson,0)); printf("strjson.(%s)\n",jprint(strjson,0));
if ( (method= jstr(strjson,"method")) != 0 ) if ( (method= jstr(strjson,"method")) != 0 )
{ {
if ( strcmp(method,"blockchain.headers.subscribe") == 0 ) if ( strcmp(method,"blockchain.headers.subscribe") == 0 )

Loading…
Cancel
Save