Fix issues with wrong base currency

From the changes in isCryptoCurrency which return true in case of BTC
there have been some bugs. We changed the check to distinguish between
altcoin and fiat to check for BTC as base currency now.
That area would require a bigger refactoring...
This commit is contained in:
Manfred Karrer 2018-11-11 18:00:43 -05:00
parent c2cb0e2965
commit 9f9349c835
No known key found for this signature in database
GPG key ID: 401250966A6B2C46
4 changed files with 4 additions and 7 deletions

View file

@ -17,8 +17,6 @@
package bisq.core.offer; package bisq.core.offer;
import bisq.core.locale.CurrencyUtil;
import bisq.network.p2p.NodeAddress; import bisq.network.p2p.NodeAddress;
import bisq.network.p2p.storage.payload.ExpirablePayload; import bisq.network.p2p.storage.payload.ExpirablePayload;
import bisq.network.p2p.storage.payload.ProtectedStoragePayload; import bisq.network.p2p.storage.payload.ProtectedStoragePayload;
@ -372,7 +370,7 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
// The rest of the app does not support yet that concept of base currency and counter currencies // The rest of the app does not support yet that concept of base currency and counter currencies
// so we map here for convenience // so we map here for convenience
public String getCurrencyCode() { public String getCurrencyCode() {
return CurrencyUtil.isCryptoCurrency(getBaseCurrencyCode()) ? getBaseCurrencyCode() : getCounterCurrencyCode(); return getBaseCurrencyCode().equals("BTC") ? getCounterCurrencyCode() : getBaseCurrencyCode();
} }
@Override @Override

View file

@ -62,6 +62,7 @@ public class AssetTradeActivityCheck {
Map<String, Tuple2<Long, Integer>> tradeStatMap = new HashMap<>(); Map<String, Tuple2<Long, Integer>> tradeStatMap = new HashMap<>();
tradeStatisticsManager.getObservableTradeStatisticsSet().stream() tradeStatisticsManager.getObservableTradeStatisticsSet().stream()
.filter(e -> !e.getBaseCurrency().equals("BTC"))
.filter(e -> CurrencyUtil.isCryptoCurrency(e.getBaseCurrency())) .filter(e -> CurrencyUtil.isCryptoCurrency(e.getBaseCurrency()))
.filter(e -> e.getTradeDate().getTime() > compareDate.getTime()) .filter(e -> e.getTradeDate().getTime() > compareDate.getTime())
.forEach(e -> { .forEach(e -> {

View file

@ -17,7 +17,6 @@
package bisq.core.trade.statistics; package bisq.core.trade.statistics;
import bisq.core.locale.CurrencyUtil;
import bisq.core.monetary.Altcoin; import bisq.core.monetary.Altcoin;
import bisq.core.monetary.AltcoinExchangeRate; import bisq.core.monetary.AltcoinExchangeRate;
import bisq.core.monetary.Price; import bisq.core.monetary.Price;
@ -223,7 +222,7 @@ public final class TradeStatistics implements LazyProcessedPayload, ProtectedSto
} }
public String getCurrencyCode() { public String getCurrencyCode() {
return CurrencyUtil.isCryptoCurrency(baseCurrency) ? baseCurrency : counterCurrency; return baseCurrency.equals("BTC") ? counterCurrency : baseCurrency;
} }
public Coin getTradeAmount() { public Coin getTradeAmount() {

View file

@ -17,7 +17,6 @@
package bisq.core.trade.statistics; package bisq.core.trade.statistics;
import bisq.core.locale.CurrencyUtil;
import bisq.core.monetary.Altcoin; import bisq.core.monetary.Altcoin;
import bisq.core.monetary.AltcoinExchangeRate; import bisq.core.monetary.AltcoinExchangeRate;
import bisq.core.monetary.Price; import bisq.core.monetary.Price;
@ -248,7 +247,7 @@ public final class TradeStatistics2 implements LazyProcessedPayload, Persistable
} }
public String getCurrencyCode() { public String getCurrencyCode() {
return CurrencyUtil.isCryptoCurrency(baseCurrency) ? baseCurrency : counterCurrency; return baseCurrency.equals("BTC") ? counterCurrency : baseCurrency;
} }
public Coin getTradeAmount() { public Coin getTradeAmount() {