mirror of
https://github.com/bisq-network/bisq.git
synced 2025-03-03 18:56:59 +01:00
Add useFullModeDaoMonitor field to PreferencesPayload
Add toggle to PreferencesView Set useFullModeDaoMonitor default to true for headless nodes
This commit is contained in:
parent
7b68686b28
commit
1abe68637d
6 changed files with 55 additions and 6 deletions
|
@ -28,6 +28,7 @@ import bisq.core.dao.governance.proofofburn.MyProofOfBurnListService;
|
|||
import bisq.core.dao.governance.proposal.MyProposalListService;
|
||||
import bisq.core.filter.FilterManager;
|
||||
import bisq.core.trade.statistics.TradeStatisticsManager;
|
||||
import bisq.core.user.Preferences;
|
||||
|
||||
import bisq.network.p2p.P2PService;
|
||||
import bisq.network.p2p.peers.PeerManager;
|
||||
|
@ -42,6 +43,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
@Slf4j
|
||||
public class AppSetupWithP2PAndDAO extends AppSetupWithP2P {
|
||||
private final DaoSetup daoSetup;
|
||||
private final Preferences preferences;
|
||||
|
||||
@Inject
|
||||
public AppSetupWithP2PAndDAO(P2PService p2PService,
|
||||
|
@ -58,6 +60,7 @@ public class AppSetupWithP2PAndDAO extends AppSetupWithP2P {
|
|||
MyProposalListService myProposalListService,
|
||||
MyReputationListService myReputationListService,
|
||||
MyProofOfBurnListService myProofOfBurnListService,
|
||||
Preferences preferences,
|
||||
Config config) {
|
||||
super(p2PService,
|
||||
p2PDataStorage,
|
||||
|
@ -69,6 +72,7 @@ public class AppSetupWithP2PAndDAO extends AppSetupWithP2P {
|
|||
config);
|
||||
|
||||
this.daoSetup = daoSetup;
|
||||
this.preferences = preferences;
|
||||
|
||||
// TODO Should be refactored/removed. In the meantime keep in sync with CorePersistedDataHost
|
||||
if (config.daoActivated) {
|
||||
|
@ -86,5 +90,8 @@ public class AppSetupWithP2PAndDAO extends AppSetupWithP2P {
|
|||
super.onBasicServicesInitialized();
|
||||
|
||||
daoSetup.onAllServicesInitialized(log::error, log::warn);
|
||||
|
||||
// For seed nodes we need to set default value to true
|
||||
preferences.setUseFullModeDaoMonitor(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -800,6 +800,11 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
|
|||
requestPersistence();
|
||||
}
|
||||
|
||||
public void setUseFullModeDaoMonitor(boolean value) {
|
||||
prefPayload.setUseFullModeDaoMonitor(value);
|
||||
requestPersistence();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Getter
|
||||
|
@ -1115,5 +1120,7 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
|
|||
void setDenyApiTaker(boolean value);
|
||||
|
||||
void setNotifyOnPreRelease(boolean value);
|
||||
|
||||
void setUseFullModeDaoMonitor(boolean value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,6 +134,7 @@ public final class PreferencesPayload implements PersistableEnvelope {
|
|||
private boolean showOffersMatchingMyAccounts;
|
||||
private boolean denyApiTaker;
|
||||
private boolean notifyOnPreRelease;
|
||||
private boolean useFullModeDaoMonitor;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
|
@ -201,7 +202,8 @@ public final class PreferencesPayload implements PersistableEnvelope {
|
|||
.setHideNonAccountPaymentMethods(hideNonAccountPaymentMethods)
|
||||
.setShowOffersMatchingMyAccounts(showOffersMatchingMyAccounts)
|
||||
.setDenyApiTaker(denyApiTaker)
|
||||
.setNotifyOnPreRelease(notifyOnPreRelease);
|
||||
.setNotifyOnPreRelease(notifyOnPreRelease)
|
||||
.setUseFullModeDaoMonitor(useFullModeDaoMonitor);
|
||||
|
||||
Optional.ofNullable(backupDirectory).ifPresent(builder::setBackupDirectory);
|
||||
Optional.ofNullable(preferredTradeCurrency).ifPresent(e -> builder.setPreferredTradeCurrency((protobuf.TradeCurrency) e.toProtoMessage()));
|
||||
|
@ -299,7 +301,8 @@ public final class PreferencesPayload implements PersistableEnvelope {
|
|||
proto.getHideNonAccountPaymentMethods(),
|
||||
proto.getShowOffersMatchingMyAccounts(),
|
||||
proto.getDenyApiTaker(),
|
||||
proto.getNotifyOnPreRelease()
|
||||
proto.getNotifyOnPreRelease(),
|
||||
proto.getUseFullModeDaoMonitor()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1335,6 +1335,18 @@ setting.preferences.dao.resyncFromGenesis.resync=Resync from genesis and shutdow
|
|||
setting.preferences.dao.isDaoFullNode=Run Bisq as DAO full node
|
||||
setting.preferences.dao.activated=DAO activated
|
||||
setting.preferences.dao.activated.popup=The change will be applied after a restart
|
||||
|
||||
setting.preferences.dao.fullModeDaoMonitor=Full-mode DAO state monitoring
|
||||
setting.preferences.dao.fullModeDaoMonitor.popup=If full-mode DAO state monitoring is activated the DAO state \
|
||||
hashes are created during parsing the BSQ blocks. This comes with considerable performance costs at the initial DAO sync.\n\n\
|
||||
For users who are regularily using Bisq this should not be an issue as there are not many blocks pending for parsing, though for \
|
||||
users who only use Bisq casually creating the DAO state hashes for 100s or 1000s of blocks degrades heavily the user experience.\n\n\
|
||||
In case full-mode is deactivated (default) the missing DAO state hashes are requested from network nodes and \
|
||||
the DAO state hash based on the most recent block will be created by the user. As all hashes are connected by \
|
||||
reference to the previous hash a correct hash at the chain tip means that all past hashes are correct as well. The \
|
||||
main functionality of the DAO state monitoring - to detect if the local DAO state is out of sync with the rest of the network - \
|
||||
is therefore still fulfilled.
|
||||
|
||||
setting.preferences.dao.rpcUser=RPC username
|
||||
setting.preferences.dao.rpcPw=RPC password
|
||||
setting.preferences.dao.blockNotifyPort=Block notify port
|
||||
|
|
|
@ -48,6 +48,7 @@ import bisq.core.locale.TradeCurrency;
|
|||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.PaymentMethod;
|
||||
import bisq.core.provider.fee.FeeService;
|
||||
import bisq.core.user.DontShowAgainLookup;
|
||||
import bisq.core.user.Preferences;
|
||||
import bisq.core.user.User;
|
||||
import bisq.core.util.FormattingUtils;
|
||||
|
@ -122,13 +123,12 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
|||
|
||||
private ToggleButton showOwnOffersInOfferBook, useAnimations, useDarkMode, sortMarketCurrenciesNumerically,
|
||||
avoidStandbyMode, useCustomFee, autoConfirmXmrToggle, hideNonAccountPaymentMethodsToggle, denyApiTakerToggle,
|
||||
notifyOnPreReleaseToggle;
|
||||
notifyOnPreReleaseToggle, isDaoFullNodeToggleButton, daoActivatedToggleButton, fullModeDaoMonitorToggleButton;
|
||||
private int gridRow = 0;
|
||||
private int displayCurrenciesGridRowIndex = 0;
|
||||
private InputTextField transactionFeeInputTextField, ignoreTradersListInputTextField, ignoreDustThresholdInputTextField,
|
||||
autoConfRequiredConfirmationsTf, autoConfServiceAddressTf, autoConfTradeLimitTf, /*referralIdInputTextField,*/
|
||||
autoConfRequiredConfirmationsTf, autoConfServiceAddressTf, autoConfTradeLimitTf,
|
||||
rpcUserTextField, blockNotifyPortTextField;
|
||||
private ToggleButton isDaoFullNodeToggleButton, daoActivatedToggleButton;
|
||||
private PasswordTextField rpcPwTextField;
|
||||
private TitledGroupBg daoOptionsTitledGroupBg;
|
||||
|
||||
|
@ -623,7 +623,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
|||
}
|
||||
|
||||
private void initializeDaoOptions() {
|
||||
int rowSpan = DevEnv.isDaoActivated() ? 5 : 1;
|
||||
int rowSpan = DevEnv.isDaoActivated() ? 6 : 1;
|
||||
daoOptionsTitledGroupBg = addTitledGroupBg(root, ++gridRow, rowSpan,
|
||||
Res.get("setting.preferences.daoOptions"), Layout.GROUP_DISTANCE);
|
||||
daoActivatedToggleButton = addSlideToggleButton(root, gridRow,
|
||||
|
@ -632,6 +632,9 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
|||
return;
|
||||
}
|
||||
|
||||
fullModeDaoMonitorToggleButton = addSlideToggleButton(root, ++gridRow,
|
||||
Res.get("setting.preferences.dao.fullModeDaoMonitor"));
|
||||
|
||||
resyncDaoFromResourcesButton = addButton(root, ++gridRow, Res.get("setting.preferences.dao.resyncFromResources.label"));
|
||||
resyncDaoFromResourcesButton.setMaxWidth(Double.MAX_VALUE);
|
||||
GridPane.setHgrow(resyncDaoFromResourcesButton, Priority.ALWAYS);
|
||||
|
@ -1021,6 +1024,21 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
|||
return;
|
||||
}
|
||||
|
||||
fullModeDaoMonitorToggleButton.setSelected(preferences.isUseFullModeDaoMonitor());
|
||||
fullModeDaoMonitorToggleButton.setOnAction(e -> {
|
||||
preferences.setUseFullModeDaoMonitor(fullModeDaoMonitorToggleButton.isSelected());
|
||||
if (fullModeDaoMonitorToggleButton.isSelected()) {
|
||||
String key = "fullModeDaoMonitor";
|
||||
if (DontShowAgainLookup.showAgain(key)) {
|
||||
new Popup().information(Res.get("setting.preferences.dao.fullModeDaoMonitor.popup"))
|
||||
.width(1000)
|
||||
.dontShowAgainId(key)
|
||||
.closeButtonText(Res.get("shared.iUnderstand"))
|
||||
.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
boolean daoFullNode = preferences.isDaoFullNode();
|
||||
isDaoFullNodeToggleButton.setSelected(daoFullNode);
|
||||
|
||||
|
@ -1173,6 +1191,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
|||
return;
|
||||
}
|
||||
|
||||
fullModeDaoMonitorToggleButton.setOnAction(null);
|
||||
resyncDaoFromResourcesButton.setOnAction(null);
|
||||
resyncDaoFromGenesisButton.setOnAction(null);
|
||||
bsqAverageTrimThresholdTextField.textProperty().removeListener(bsqAverageTrimThresholdListener);
|
||||
|
|
|
@ -1945,6 +1945,7 @@ message PreferencesPayload {
|
|||
bool show_offers_matching_my_accounts = 59;
|
||||
bool deny_api_taker = 60;
|
||||
bool notify_on_pre_release = 61;
|
||||
bool use_full_mode_dao_monitor = 62;
|
||||
}
|
||||
|
||||
message AutoConfirmSettings {
|
||||
|
|
Loading…
Add table
Reference in a new issue