From 7707c8f85db91ac44497ca7db91962f519fe3893 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 19 Oct 2017 22:44:19 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_commands.c | 5 +++-- iguana/exchanges/LP_rpc.c | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index acd0769fb..cc4b8359d 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -195,13 +195,14 @@ stop()\n\ } else if ( strcmp(method,"notarizations") == 0 ) { - int32_t height; + int32_t height,bestheight; if ( (ptr= LP_coinsearch(coin)) != 0 ) { - height = LP_notarization_latest(ptr); + height = LP_notarization_latest(&bestheight,ptr); retjson = cJSON_CreateObject(); jaddstr(retjson,"result","success"); jaddnum(retjson,"lastnotarization",height); + jaddnum(retjson,"bestheight",bestheight); return(jprint(retjson,1)); } else return(clonestr("{\"error\":\"cant find coin\"}")); } diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 1d7572f16..6ec086991 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -1036,7 +1036,7 @@ int32_t LP_hasnotarization(struct iguana_info *coin,cJSON *blockjson) return(hasnotarization); } -int32_t LP_notarization_latest(struct iguana_info *coin) +int32_t LP_notarization_latest(int32_t *bestheightp,struct iguana_info *coin) { cJSON *blockjson; bits256 blockhash; int32_t height=-1,hasnotarization; memset(blockhash.bytes,0,sizeof(blockhash)); @@ -1049,6 +1049,8 @@ int32_t LP_notarization_latest(struct iguana_info *coin) char str[65]; printf("check %s\n",bits256_str(str,blockhash)); if ( (blockjson= LP_getblock(coin->symbol,blockhash)) != 0 ) { + if ( *bestheightp < 0 ) + *bestheightp = jint(blockjson,"height"); if ( (hasnotarization= LP_hasnotarization(coin,blockjson)) > 0 ) { height = jint(blockjson,"height");