On mainNet we expect to have received a filter object, if not show a

popup to the user to inform the Bisq devs.
Set filterWarningHandler before calling onAllServicesInitialized
This commit is contained in:
chimp1984 2021-01-30 13:08:00 -05:00
parent 3781b5f8b3
commit a8fc33c30d
No known key found for this signature in database
GPG key ID: 9801B4EC591F90E3
3 changed files with 11 additions and 1 deletions

View file

@ -242,8 +242,8 @@ public class DomainInitialisation {
priceFeedService.setCurrencyCodeOnInit();
filterManager.onAllServicesInitialized();
filterManager.setFilterWarningHandler(filterWarningHandler);
filterManager.onAllServicesInitialized();
voteResultService.getVoteResultExceptions().addListener((ListChangeListener<VoteResultException>) c -> {
c.next();

View file

@ -103,6 +103,7 @@ public class FilterManager {
private final List<String> publicKeys;
private ECKey filterSigningKey;
private final Set<Filter> invalidFilters = new HashSet<>();
private Consumer<String> filterWarningHandler;
///////////////////////////////////////////////////////////////////////////////////////////
@ -152,6 +153,12 @@ public class FilterManager {
.map(protectedStoragePayload -> (Filter) protectedStoragePayload)
.forEach(this::onFilterAddedFromNetwork);
// On mainNet we expect to have received a filter object, if not show a popup to the user to inform the
// Bisq devs.
if (Config.baseCurrencyNetwork().isMainnet() && getFilter() == null) {
filterWarningHandler.accept(Res.get("popup.warning.noFilter"));
}
p2PService.addHashSetChangedListener(new HashMapChangedListener() {
@Override
public void onAdded(Collection<ProtectedStorageEntry> protectedStorageEntries) {
@ -216,6 +223,8 @@ public class FilterManager {
}
public void setFilterWarningHandler(Consumer<String> filterWarningHandler) {
this.filterWarningHandler = filterWarningHandler;
addListener(filter -> {
if (filter != null && filterWarningHandler != null) {
if (filter.getSeedNodes() != null && !filter.getSeedNodes().isEmpty()) {

View file

@ -2841,6 +2841,7 @@ popup.warning.mandatoryUpdate.dao=Please update to the latest Bisq version. \
Please check out the Bisq Forum for more information.
popup.warning.disable.dao=The Bisq DAO and BSQ are temporary disabled. \
Please check out the Bisq Forum for more information.
popup.warning.noFilter=We did not receive a filter object from the seed nodes. This is a not expected situation. Please inform the Bisq developers.
popup.warning.burnBTC=This transaction is not possible, as the mining fees of {0} would exceed the amount to transfer of {1}. \
Please wait until the mining fees are low again or until you''ve accumulated more BTC to transfer.