From 1ffbaac87e7cb3fe49c6da5946f4b9c5ab48f1ae Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 19 Oct 2017 13:09:52 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_rpc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 18a7c89e1..7620591c7 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -203,7 +203,7 @@ cJSON *LP_assethbla(char *assetid) int32_t LP_getheight(struct iguana_info *coin) { - cJSON *retjson; char *method = "getinfo"; int32_t height; + cJSON *retjson; char *retstr,*method = "getinfo"; int32_t height; if ( coin == 0 ) return(-1); height = coin->height; @@ -211,11 +211,16 @@ int32_t LP_getheight(struct iguana_info *coin) { if ( strcmp(coin->symbol,"BTC") == 0 ) method = "getblockchaininfo"; - if ( (retjson= bitcoin_json(coin,method,"[]")) != 0 ) + retstr = bitcoind_passthru(coin->symbol,coin->serverport,coin->userpass,method,"[]"); + printf("%s.(%s %s): %s.%s -> (%s)\n",coin->symbol,coin->serverport,coin->userpass,method,"[]",retstr); + if ( retstr != 0 && retstr[0] != 0 ) { + retjson = cJSON_Parse(retstr); coin->height = height = jint(retjson,"blocks"); free_json(retjson); - coin->heighttime = (uint32_t)time(NULL); + if ( coin->height > 0 ) + coin->heighttime = (uint32_t)time(NULL); + free(retstr); } } return(height);