Browse Source

Error check cmc price

etomic
jl777 7 years ago
parent
commit
e152215c96
  1. 3
      iguana/exchanges/LP_commands.c
  2. 4
      iguana/exchanges/LP_portfolio.c

3
iguana/exchanges/LP_commands.c

@ -187,10 +187,11 @@ jpg(srcfile, destfile, power2=7, passphrase, data="", required)\n\
// if passphrase api and passphrase is right, ignore userpass, use hass of passphrase
if ( strcmp(method,"passphrase") == 0 && (passphrase= jstr(argjson,"passphrase")) != 0 )
{
bits256 passhash;
bits256 passhash; char str[65],str2[65];
vcalc_sha256(0,passhash.bytes,(uint8_t *)passphrase,(int32_t)strlen(passphrase));
if ( bits256_cmp(passhash,G.LP_passhash) == 0 )
authenticated = 1;
else printf("passhash %s != G %s\n",bits256_str(str,passhash),bits256_str(str2,G.LP_passhash));
}
if ( authenticated == 0 && ((userpass= jstr(argjson,"userpass")) == 0 || strcmp(userpass,G.USERPASS) != 0) )
return(clonestr("{\"error\":\"authentication error you need to make sure userpass is set\"}"));

4
iguana/exchanges/LP_portfolio.c

@ -570,9 +570,9 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
//printf("%s/%s for %s/%s margin %.8f\n",base,rel,LP_autorefs[i].refbase,LP_autorefs[i].refrel,margin);
if ( (price_btc= LP_CMCbtcprice(&price_usd,LP_autorefs[i].refbase)) > SMALLVAL )
{
if ( strcmp(rel,"KMD") == 0 )
if ( strcmp(rel,"KMD") == 0 && kmd_btc > SMALLVAL )
price = kmd_btc / price_btc;
else if ( strcmp(rel,"BCH") == 0 )
else if ( strcmp(rel,"BCH") == 0 && bch_btc > SMALLVAL )
price = bch_btc / price_btc;
else if ( strcmp(rel,"BTC") == 0 )
price = 1. / price_btc;

Loading…
Cancel
Save