Skip to content

Commit

Permalink
If AutoConfirmSettings contain a retired address we reset to the defa…
Browse files Browse the repository at this point in the history
…ult values

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
  • Loading branch information
HenrikJannsen committed Jul 21, 2024
1 parent b8e3296 commit 2e25342
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion core/src/main/java/bisq/core/user/AutoConfirmSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@
import java.util.concurrent.CopyOnWriteArrayList;

import lombok.Getter;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;

@ToString
@Slf4j
@Getter
public final class AutoConfirmSettings implements PersistablePayload {
Expand All @@ -43,7 +45,7 @@ public interface Listener {
private long tradeLimit;
private List<String> serviceAddresses;
private String currencyCode;
private List<Listener> listeners = new CopyOnWriteArrayList<>();
private final List<Listener> listeners = new CopyOnWriteArrayList<>();

@SuppressWarnings("SameParameterValue")
static Optional<AutoConfirmSettings> getDefault(List<String> serviceAddresses, String currencyCode) {
Expand Down
10 changes: 9 additions & 1 deletion core/src/main/java/bisq/core/user/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,20 @@ private void setupPreferences() {
setUsePriceNotifications(true);
}

if (prefPayload.getAutoConfirmSettingsList().isEmpty()) {
// Remove retired XMR AutoConfirm address
var doApplyDefaults = prefPayload.getAutoConfirmSettingsList().stream()
.map(autoConfirmSettings -> autoConfirmSettings.getServiceAddresses().stream()
.anyMatch(address -> address.contains("monero3bec7m26vx6si6qo7q7imlaoz45ot5m2b5z2ppgoooo6jx2rqd")))
.findAny()
.orElse(true);
if (doApplyDefaults) {
prefPayload.getAutoConfirmSettingsList().clear();
List<String> defaultXmrTxProofServices = getDefaultXmrTxProofServices();
AutoConfirmSettings.getDefault(defaultXmrTxProofServices, "XMR")
.ifPresent(xmrAutoConfirmSettings -> {
getAutoConfirmSettingsList().add(xmrAutoConfirmSettings);
});
persistenceManager.forcePersistNow();
}

// We set the capability in CoreNetworkCapabilities if the program argument is set.
Expand Down

0 comments on commit 2e25342

Please sign in to comment.