mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-23 03:59:36 +00:00
revert price feed changes of #129 due to error when all tests run
observing "error applying consumer" in alice console when all tests run
This commit is contained in:
parent
68e0bba6ac
commit
4d81d98e00
2 changed files with 7 additions and 7 deletions
|
@ -27,6 +27,7 @@ import java.util.function.Consumer;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import static bisq.common.util.MathUtils.roundDouble;
|
||||
import static bisq.core.locale.CurrencyUtil.isFiatCurrency;
|
||||
import static java.lang.String.format;
|
||||
|
||||
@Singleton
|
||||
|
@ -43,11 +44,14 @@ class CorePriceService {
|
|||
public void getMarketPrice(String currencyCode, Consumer<Double> resultHandler) {
|
||||
String upperCaseCurrencyCode = currencyCode.toUpperCase();
|
||||
|
||||
if (!isFiatCurrency(upperCaseCurrencyCode))
|
||||
throw new IllegalStateException(format("%s is not a valid currency code", upperCaseCurrencyCode));
|
||||
|
||||
if (!priceFeedService.hasPrices())
|
||||
throw new IllegalStateException("price feed service has no prices");
|
||||
|
||||
try {
|
||||
priceFeedService.setCurrencyCode(upperCaseCurrencyCode, false); // TODO (woodser): skipping applying to consumer to avoid console warning spam when getting market prices over the api
|
||||
priceFeedService.setCurrencyCode(upperCaseCurrencyCode);
|
||||
} catch (Throwable throwable) {
|
||||
log.warn("Could not set currency code in PriceFeedService", throwable);
|
||||
}
|
||||
|
|
|
@ -270,19 +270,15 @@ public class PriceFeedService {
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void setCurrencyCode(String currencyCode) {
|
||||
setCurrencyCode(currencyCode, true);
|
||||
}
|
||||
|
||||
// TODO (woodser): necessary to skip applying to consumer to avoid console warning spam when getting market prices over the api
|
||||
public void setCurrencyCode(String currencyCode, boolean applyPriceToConsumer) {
|
||||
if (this.currencyCode == null || !this.currencyCode.equals(currencyCode)) {
|
||||
this.currencyCode = currencyCode;
|
||||
currencyCodeProperty.set(currencyCode);
|
||||
if (applyPriceToConsumer && priceConsumer != null)
|
||||
if (priceConsumer != null)
|
||||
applyPriceToConsumer();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Getter
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in a new issue