From 0b31d13aa1efc840a2f9c3d00cc3e28462a59af0 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Mon, 9 Mar 2020 14:55:05 +0100 Subject: [PATCH 1/2] Re-introduce CoinMarketCap stub to prevent error in existing clients --- .../price/spot/providers/CoinMarketCap.java | 44 +++++++++++++++++++ .../bisq/price/spot/providers/Poloniex.java | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 pricenode/src/main/java/bisq/price/spot/providers/CoinMarketCap.java diff --git a/pricenode/src/main/java/bisq/price/spot/providers/CoinMarketCap.java b/pricenode/src/main/java/bisq/price/spot/providers/CoinMarketCap.java new file mode 100644 index 0000000000..0a7ce5d4c4 --- /dev/null +++ b/pricenode/src/main/java/bisq/price/spot/providers/CoinMarketCap.java @@ -0,0 +1,44 @@ +/* + * This file is part of Bisq. + * + * Bisq is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Bisq is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Bisq. If not, see . + */ + +package bisq.price.spot.providers; + +import bisq.price.spot.ExchangeRate; +import bisq.price.spot.ExchangeRateProvider; + +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import java.time.Duration; + +import java.util.Collections; +import java.util.Set; + +@Component +@Order(3) +class CoinMarketCap extends ExchangeRateProvider { + + public CoinMarketCap() { + super("CMC", "coinmarketcap", Duration.ofMinutes(5)); // large data structure, so don't request it too often + } + + @Override + public Set doGet() { + + return Collections.emptySet(); + } +} diff --git a/pricenode/src/main/java/bisq/price/spot/providers/Poloniex.java b/pricenode/src/main/java/bisq/price/spot/providers/Poloniex.java index c62401492e..684f867b25 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/Poloniex.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/Poloniex.java @@ -42,7 +42,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; @Component -@Order(3) +@Order(4) class Poloniex extends ExchangeRateProvider { private final RestTemplate restTemplate = new RestTemplate(); From 537f3d4999f7354e36ecbf9b08c2bb1cfaf8505f Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Mon, 9 Mar 2020 15:23:25 +0100 Subject: [PATCH 2/2] Add documentation --- .../java/bisq/price/spot/providers/CoinMarketCap.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pricenode/src/main/java/bisq/price/spot/providers/CoinMarketCap.java b/pricenode/src/main/java/bisq/price/spot/providers/CoinMarketCap.java index 0a7ce5d4c4..0dc66873a6 100644 --- a/pricenode/src/main/java/bisq/price/spot/providers/CoinMarketCap.java +++ b/pricenode/src/main/java/bisq/price/spot/providers/CoinMarketCap.java @@ -28,6 +28,9 @@ import java.time.Duration; import java.util.Collections; import java.util.Set; +/** + * Stub implementation of CoinMarketCap price provider to prevent NullPointerExceptions within legacy clients + */ @Component @Order(3) class CoinMarketCap extends ExchangeRateProvider { @@ -36,6 +39,12 @@ class CoinMarketCap extends ExchangeRateProvider { super("CMC", "coinmarketcap", Duration.ofMinutes(5)); // large data structure, so don't request it too often } + /** + * Returns an empty Set for the CoinMarketCap price provider. + * Price data of CMC provider is not used in the client anymore, except for the last update timestamp. + * + * @return Empty Set + */ @Override public Set doGet() {