Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy BSQ altcoin trading #7016

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/main/java/bisq/core/locale/CurrencyUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ public static Optional<Asset> findAsset(String tickerSymbol, BaseCurrencyNetwork
public static List<CryptoCurrency> getActiveSortedCryptoCurrencies(AssetService assetService,
FilterManager filterManager) {
return getAllSortedCryptoCurrencies().stream()
.filter(e -> e.getCode().equals("BSQ") || assetService.isActive(e.getCode()))
.filter(e -> assetService.isActive(e.getCode()))
.filter(e -> !filterManager.isCurrencyBanned(e.getCode()))
.collect(Collectors.toList());
}
Expand Down
15 changes: 14 additions & 1 deletion core/src/main/java/bisq/core/user/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import bisq.core.notifications.alerts.market.MarketAlertFilter;
import bisq.core.notifications.alerts.price.PriceAlertFilter;
import bisq.core.payment.BsqSwapAccount;
import bisq.core.payment.CryptoCurrencyAccount;
import bisq.core.payment.PaymentAccount;
import bisq.core.support.dispute.arbitration.arbitrator.Arbitrator;
import bisq.core.support.dispute.mediation.mediator.Mediator;
Expand All @@ -49,11 +50,13 @@
import javafx.collections.SetChangeListener;

import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;

import lombok.AllArgsConstructor;
Expand Down Expand Up @@ -417,7 +420,17 @@ public ReadOnlyObjectProperty<PaymentAccount> currentPaymentAccountProperty() {

@Nullable
public Set<PaymentAccount> getPaymentAccounts() {
return userPayload.getPaymentAccounts();
if (userPayload.getPaymentAccounts() == null) {
return Collections.emptySet();
}
// filter BSQ altcoin accounts to implement github #7011: remove legacy BSQ (altcoin) trading
Predicate<PaymentAccount> identifyBsqAltcoinAccount = p ->
p instanceof CryptoCurrencyAccount &&
p.getSingleTradeCurrency() != null &&
p.getSingleTradeCurrency().getCode().equalsIgnoreCase("BSQ");
return userPayload.getPaymentAccounts().stream()
.filter(identifyBsqAltcoinAccount.negate())
.collect(Collectors.toSet());
}

public ObservableSet<PaymentAccount> getPaymentAccountsAsObservable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,8 @@ public void onAdded(Offer offer) {
// We filter here to only add new offers if the same offer (using equals) was not already added and it
// is not banned.

if (filterManager.isOfferIdBanned(offer.getId())) {
log.debug("Ignored banned offer. ID={}", offer.getId());
return;
}

if (offer.isBsqSwapOffer() && !filterManager.isProofOfWorkValid(offer)) {
log.info("Proof of work of offer with id {} is not valid.", offer.getId());
return;
}

if (OfferRestrictions.requiresNodeAddressUpdate() && !Utils.isV3Address(offer.getMakerNodeAddress().getHostName())) {
log.debug("Ignored offer with Tor v2 node address. ID={}", offer.getId());
if (!isOfferAllowed(offer)) {
log.debug("Offer {} is not allowed.", offer.getId());
return;
}

Expand Down Expand Up @@ -257,9 +247,11 @@ public Map<String, Integer> getSellOfferCountMap() {
private boolean isOfferAllowed(Offer offer) {
boolean isBanned = filterManager.isOfferIdBanned(offer.getId())
|| filterManager.isNodeAddressBanned(offer.getMakerNodeAddress());
boolean isBannedBsqAltcoinsOffer = (offer.getPaymentMethod().isBlockchain() && offer.getBaseCurrencyCode().equalsIgnoreCase("BSQ"));
boolean invalidBsqSwap = offer.isBsqSwapOffer() && !filterManager.isProofOfWorkValid(offer);
boolean isV3NodeAddressCompliant = !OfferRestrictions.requiresNodeAddressUpdate()
|| Utils.isV3Address(offer.getMakerNodeAddress().getHostName());
return !isBanned && isV3NodeAddressCompliant;
return !isBanned && !isBannedBsqAltcoinsOffer && !invalidBsqSwap && isV3NodeAddressCompliant;
}

private void fillOfferCountMaps() {
Expand Down