Browse Source

Test

etomic
jl777 8 years ago
parent
commit
7707c8f85d
  1. 5
      iguana/exchanges/LP_commands.c
  2. 4
      iguana/exchanges/LP_rpc.c

5
iguana/exchanges/LP_commands.c

@ -195,13 +195,14 @@ stop()\n\
} }
else if ( strcmp(method,"notarizations") == 0 ) else if ( strcmp(method,"notarizations") == 0 )
{ {
int32_t height; int32_t height,bestheight;
if ( (ptr= LP_coinsearch(coin)) != 0 ) if ( (ptr= LP_coinsearch(coin)) != 0 )
{ {
height = LP_notarization_latest(ptr); height = LP_notarization_latest(&bestheight,ptr);
retjson = cJSON_CreateObject(); retjson = cJSON_CreateObject();
jaddstr(retjson,"result","success"); jaddstr(retjson,"result","success");
jaddnum(retjson,"lastnotarization",height); jaddnum(retjson,"lastnotarization",height);
jaddnum(retjson,"bestheight",bestheight);
return(jprint(retjson,1)); return(jprint(retjson,1));
} else return(clonestr("{\"error\":\"cant find coin\"}")); } else return(clonestr("{\"error\":\"cant find coin\"}"));
} }

4
iguana/exchanges/LP_rpc.c

@ -1036,7 +1036,7 @@ int32_t LP_hasnotarization(struct iguana_info *coin,cJSON *blockjson)
return(hasnotarization); 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; cJSON *blockjson; bits256 blockhash; int32_t height=-1,hasnotarization;
memset(blockhash.bytes,0,sizeof(blockhash)); 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)); char str[65]; printf("check %s\n",bits256_str(str,blockhash));
if ( (blockjson= LP_getblock(coin->symbol,blockhash)) != 0 ) if ( (blockjson= LP_getblock(coin->symbol,blockhash)) != 0 )
{ {
if ( *bestheightp < 0 )
*bestheightp = jint(blockjson,"height");
if ( (hasnotarization= LP_hasnotarization(coin,blockjson)) > 0 ) if ( (hasnotarization= LP_hasnotarization(coin,blockjson)) > 0 )
{ {
height = jint(blockjson,"height"); height = jint(blockjson,"height");

Loading…
Cancel
Save