Browse Source

Test

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

20
iguana/exchanges/LP_rpc.c

@ -112,7 +112,7 @@ char *LP_apicall(struct iguana_info *coin,char *method,char *params)
cJSON *bitcoin_json(struct iguana_info *coin,char *method,char *params)
{
cJSON *retjson = 0; char *retstr;
cJSON *resultjson,*retjson = 0; char *retstr;
// "getinfo", "getrawmempool", "paxprice", "gettxout", "getrawtransaction", "getblock", "listunspent", "listtransactions", "validateaddress", "importprivkey"
// bitcoind_passthru callers: "importaddress", "estimatefee", "getblockhash", "sendrawtransaction", "signrawtransaction"
if ( coin != 0 )
@ -134,6 +134,12 @@ cJSON *bitcoin_json(struct iguana_info *coin,char *method,char *params)
{
retjson = electrum_submit(coin->symbol,coin->electrum,0,method,params,LP_HTTP_TIMEOUT);
printf("electrum %s.%s -> (%s)\n",method,params,jprint(retjson,0));
if ( (resultjson= jobj(retjson,"result")) != 0 )
{
resultjson = jduplicate(resultjson);
free_json(retjson);
retjson = resultjson;
}
}
} else retjson = cJSON_Parse("{\"result\":\"disabled\"}");
} else printf("bitcoin_json cant talk to NULL coin\n");
@ -220,8 +226,16 @@ cJSON *LP_gettxout(char *symbol,bits256 txid,int32_t vout)
cJSON *LP_gettx(char *symbol,bits256 txid)
{
char buf[128],str[65]; struct iguana_info *coin = LP_coinfind(symbol);
sprintf(buf,"[\"%s\", 1]",bits256_str(str,txid));
return(bitcoin_json(coin,"getrawtransaction",buf));
if ( coin->electrum == 0 )
{
sprintf(buf,"[\"%s\", 1]",bits256_str(str,txid));
return(bitcoin_json(coin,"getrawtransaction",buf));
}
else
{
sprintf(buf,"[\"%s\"]",bits256_str(str,txid));
return(bitcoin_json(coin,"blockchain.transaction.get",buf));
}
}
cJSON *LP_getblock(char *symbol,bits256 txid)

4
iguana/exchanges/LP_socket.c

@ -522,7 +522,7 @@ int32_t LP_recvfunc(struct electrum_info *ep,char *str,int32_t len)
{
*(ep->heightp) = height;
*(ep->heighttimep) = (uint32_t)time(NULL);
printf(">>>>>>>>> set height.%d\n",height);
printf("ELECTRUM >>>>>>>>> set height.%d\n",height);
}
}
idnum = juint(strjson,"id");
@ -558,7 +558,7 @@ int32_t LP_recvfunc(struct electrum_info *ep,char *str,int32_t len)
{
// do callback
stritem = (struct stritem *)item;
printf("callback.%p (%s) -> (%s)\n",strjson,stritem->str,jprint(strjson,0));
//printf("callback.%p (%s) -> (%s)\n",strjson,stritem->str,jprint(strjson,0));
if ( stritem->retptrp != 0 )
{
*((cJSON **)stritem->retptrp) = strjson;

Loading…
Cancel
Save