mirror of
https://github.com/bisq-network/bisq.git
synced 2025-01-18 21:35:03 +01:00
Merge pull request #6738 from HenrikJannsen/add_bm_accounting_preferences
Add reset buttons for BM accounting
This commit is contained in:
commit
67182ca41f
@ -271,6 +271,15 @@ public class BurningManAccountingService implements DaoSetupService, DaoStateLis
|
||||
}
|
||||
|
||||
|
||||
public void resyncAccountingDataFromScratch(Runnable resultHandler) {
|
||||
burningManAccountingStoreService.removeAllBlocks(resultHandler);
|
||||
}
|
||||
|
||||
public void resyncAccountingDataFromResources() {
|
||||
burningManAccountingStoreService.deleteStorageFile();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Delegates
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -38,15 +38,16 @@ public class AccountingNodeProvider {
|
||||
@Inject
|
||||
public AccountingNodeProvider(AccountingLiteNode liteNode,
|
||||
AccountingFullNode fullNode,
|
||||
@Named(Config.IS_BM_FULL_NODE) boolean isBmFullNode,
|
||||
@Named(Config.IS_BM_FULL_NODE) boolean isBmFullNodeFromOptions,
|
||||
Preferences preferences) {
|
||||
|
||||
boolean rpcDataSet = preferences.getRpcUser() != null &&
|
||||
!preferences.getRpcUser().isEmpty()
|
||||
&& preferences.getRpcPw() != null &&
|
||||
!preferences.getRpcPw().isEmpty() &&
|
||||
String rpcUser = preferences.getRpcUser();
|
||||
String rpcPw = preferences.getRpcPw();
|
||||
boolean rpcDataSet = rpcUser != null && !rpcUser.isEmpty() &&
|
||||
rpcPw != null && !rpcPw.isEmpty() &&
|
||||
preferences.getBlockNotifyPort() > 0;
|
||||
if (isBmFullNode && rpcDataSet) {
|
||||
boolean fullBMAccountingNode = preferences.isFullBMAccountingNode();
|
||||
if ((fullBMAccountingNode || isBmFullNodeFromOptions) && rpcDataSet) {
|
||||
accountingNode = fullNode;
|
||||
} else {
|
||||
accountingNode = liteNode;
|
||||
|
@ -81,6 +81,16 @@ public class BurningManAccountingStore implements PersistableEnvelope {
|
||||
}
|
||||
}
|
||||
|
||||
public void removeAllBlocks() {
|
||||
Lock writeLock = readWriteLock.writeLock();
|
||||
writeLock.lock();
|
||||
try {
|
||||
blocks.clear();
|
||||
} finally {
|
||||
writeLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public Optional<AccountingBlock> getLastBlock() {
|
||||
Lock readLock = readWriteLock.readLock();
|
||||
readLock.lock();
|
||||
|
@ -49,6 +49,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Singleton
|
||||
public class BurningManAccountingStoreService extends StoreService<BurningManAccountingStore> {
|
||||
private static final String FILE_NAME = "BurningManAccountingStore_v2";
|
||||
private volatile boolean removeAllBlocksCalled;
|
||||
|
||||
@Inject
|
||||
public BurningManAccountingStoreService(ResourceDataStoreService resourceDataStoreService,
|
||||
@ -82,6 +83,9 @@ public class BurningManAccountingStoreService extends StoreService<BurningManAcc
|
||||
}
|
||||
|
||||
public void addIfNewBlock(AccountingBlock block) throws BlockHashNotConnectingException, BlockHeightNotConnectingException {
|
||||
if (removeAllBlocksCalled) {
|
||||
return;
|
||||
}
|
||||
store.addIfNewBlock(block);
|
||||
requestPersistence();
|
||||
}
|
||||
@ -91,10 +95,27 @@ public class BurningManAccountingStoreService extends StoreService<BurningManAcc
|
||||
}
|
||||
|
||||
public void purgeLastTenBlocks() {
|
||||
if (removeAllBlocksCalled) {
|
||||
return;
|
||||
}
|
||||
store.purgeLastTenBlocks();
|
||||
requestPersistence();
|
||||
}
|
||||
|
||||
public void removeAllBlocks(Runnable resultHandler) {
|
||||
removeAllBlocksCalled = true;
|
||||
store.removeAllBlocks();
|
||||
persistenceManager.persistNow(resultHandler);
|
||||
}
|
||||
|
||||
public void deleteStorageFile() {
|
||||
try {
|
||||
FileUtil.deleteFileIfExists(Path.of(absolutePathOfStorageDir, FILE_NAME).toFile());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public Optional<AccountingBlock> getLastBlock() {
|
||||
return store.getLastBlock();
|
||||
}
|
||||
|
@ -772,7 +772,7 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
|
||||
|
||||
public void setDaoFullNode(boolean value) {
|
||||
// We only persist if we have not set the program argument
|
||||
if (config.fullDaoNodeOptionSetExplicitly) {
|
||||
if (!config.fullDaoNodeOptionSetExplicitly) {
|
||||
prefPayload.setDaoFullNode(value);
|
||||
requestPersistence();
|
||||
}
|
||||
@ -853,6 +853,11 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
|
||||
requestPersistence();
|
||||
}
|
||||
|
||||
public void setFullBMAccountingNode(boolean isFullBMAccountingNode) {
|
||||
prefPayload.setFullBMAccountingNode(isFullBMAccountingNode);
|
||||
requestPersistence();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Getter
|
||||
@ -1023,6 +1028,10 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
|
||||
return fullAccountingNodeFromOptions || prefPayload.isProcessBurningManAccountingData();
|
||||
}
|
||||
|
||||
public boolean isFullBMAccountingNode() {
|
||||
return prefPayload.isFullBMAccountingNode();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private
|
||||
@ -1145,6 +1154,8 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
|
||||
|
||||
boolean isProcessBurningManAccountingData();
|
||||
|
||||
boolean isFullBMAccountingNode();
|
||||
|
||||
void setDaoFullNode(boolean value);
|
||||
|
||||
void setRpcUser(String value);
|
||||
@ -1190,5 +1201,7 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
|
||||
void setUserHasRaisedTradeLimit(boolean userHasRaisedTradeLimit);
|
||||
|
||||
void setProcessBurningManAccountingData(boolean processBurningManAccountingData);
|
||||
|
||||
void setFullBMAccountingNode(boolean isFullBMAccountingNode);
|
||||
}
|
||||
}
|
||||
|
@ -148,6 +148,10 @@ public final class PreferencesPayload implements PersistableEnvelope {
|
||||
// Added at 1.9.11
|
||||
private boolean processBurningManAccountingData = false;
|
||||
|
||||
// Added at 1.9.11
|
||||
private boolean isFullBMAccountingNode = false;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -220,7 +224,8 @@ public final class PreferencesPayload implements PersistableEnvelope {
|
||||
.setUseBitcoinUrisInQrCodes(useBitcoinUrisInQrCodes)
|
||||
.setUserDefinedTradeLimit(userDefinedTradeLimit)
|
||||
.setUserHasRaisedTradeLimit(userHasRaisedTradeLimit)
|
||||
.setProcessBurningManAccountingData(processBurningManAccountingData);
|
||||
.setProcessBurningManAccountingData(processBurningManAccountingData)
|
||||
.setIsFullBMAccountingNode(isFullBMAccountingNode);
|
||||
|
||||
Optional.ofNullable(backupDirectory).ifPresent(builder::setBackupDirectory);
|
||||
Optional.ofNullable(preferredTradeCurrency).ifPresent(e -> builder.setPreferredTradeCurrency((protobuf.TradeCurrency) e.toProtoMessage()));
|
||||
@ -328,7 +333,8 @@ public final class PreferencesPayload implements PersistableEnvelope {
|
||||
proto.getUseBitcoinUrisInQrCodes(),
|
||||
proto.getUserHasRaisedTradeLimit() ? proto.getUserDefinedTradeLimit() : Preferences.INITIAL_TRADE_LIMIT,
|
||||
proto.getUserHasRaisedTradeLimit(),
|
||||
proto.getProcessBurningManAccountingData()
|
||||
proto.getProcessBurningManAccountingData(),
|
||||
proto.getIsFullBMAccountingNode()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1427,6 +1427,28 @@ setting.preferences.resetAllFlags=Reset all \"Don't show again\" flags
|
||||
settings.preferences.languageChange=To apply the language change to all screens requires a restart.
|
||||
settings.preferences.supportLanguageWarning=In case of a dispute, please note that mediation is handled in {0} and arbitration in {1}.
|
||||
setting.preferences.daoOptions=DAO options
|
||||
|
||||
setting.preferences.dao.resyncBMAccFromScratch=Resync from scratch
|
||||
setting.preferences.dao.resyncBMAccFromScratch.popup=To resync the Burningmen accounting data from scratch you need to run a full Bitcoin node.\n\
|
||||
It will take considerable time and CPU resources as it resyncs from 2020 when legacy BM started. Depending on your CPU resources that can take 20-40 hours.\n\n\
|
||||
Are you sure you want to do that?\n\n\
|
||||
Mostly a resync from latest resource files is sufficient and much faster.\n\n\
|
||||
If you proceed, after an application restart the Burningmen accounting data will be rebuild from the transactions requested from your Bitcoin node.
|
||||
setting.preferences.dao.resyncBMAccFromScratch.resync=Resync from scratch and shutdown
|
||||
setting.preferences.dao.isFullBMAccountingNode=Full BM accounting node
|
||||
setting.preferences.dao.resyncBMAccFromResources=Resync from resources
|
||||
setting.preferences.dao.resyncBMAccFromResources.popup=To resync the Burningmen accounting data from resources you \
|
||||
will reapply the data from resources of your last downloaded Bisq version and load the missing data from the network.\n\
|
||||
Depending on the age of your last Bisq download that might take a while.\n\n\
|
||||
Are you sure you want to do that?
|
||||
setting.preferences.dao.resyncBMAccFromResources.resync=Resync from resources and shutdown
|
||||
|
||||
setting.preferences.dao.useFullBMAccountingNode.noDaoMode.popup=To run as full Burningmen accounting node you need to run as full DAO node as well.\n\n\
|
||||
Please enable first the Full-DAO mode option and config RPC.
|
||||
setting.preferences.dao.useFullBMAccountingNode.enabledDaoMode.popup=To run as full Burningmen accounting node can take considerable time and CPU resources.\n\n\
|
||||
A restart is required to enable that change.\n\n\
|
||||
Do you want to enable full Burningmen accounting mode?.
|
||||
|
||||
setting.preferences.dao.resyncFromGenesis.label=Rebuild DAO state from genesis tx
|
||||
setting.preferences.dao.resyncFromResources.label=Rebuild DAO state from resources
|
||||
setting.preferences.dao.resyncFromResources.popup=After an application restart the Bisq network governance data will be reloaded from \
|
||||
|
@ -35,6 +35,7 @@ import bisq.desktop.util.validation.BtcValidator;
|
||||
|
||||
import bisq.core.btc.wallet.Restrictions;
|
||||
import bisq.core.dao.DaoFacade;
|
||||
import bisq.core.dao.burningman.accounting.BurningManAccountingService;
|
||||
import bisq.core.dao.governance.asset.AssetService;
|
||||
import bisq.core.filter.Filter;
|
||||
import bisq.core.filter.FilterManager;
|
||||
@ -122,6 +123,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
@FxmlView
|
||||
public class PreferencesView extends ActivatableViewAndModel<GridPane, PreferencesViewModel> {
|
||||
private final User user;
|
||||
private final BurningManAccountingService burningManAccountingService;
|
||||
private final CoinFormatter formatter;
|
||||
private TextField btcExplorerTextField, bsqExplorerTextField;
|
||||
private ComboBox<String> userLanguageComboBox;
|
||||
@ -131,7 +133,8 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
private ToggleButton showOwnOffersInOfferBook, useAnimations, useDarkMode, sortMarketCurrenciesNumerically,
|
||||
avoidStandbyMode, useCustomFee, autoConfirmXmrToggle, hideNonAccountPaymentMethodsToggle, denyApiTakerToggle,
|
||||
notifyOnPreReleaseToggle, isDaoFullNodeToggleButton,
|
||||
fullModeDaoMonitorToggleButton, useBitcoinUrisToggle, tradeLimitToggle, processBurningManAccountingDataToggleButton;
|
||||
fullModeDaoMonitorToggleButton, useBitcoinUrisToggle, tradeLimitToggle, processBurningManAccountingDataToggleButton,
|
||||
isFullBMAccountingDataNodeToggleButton;
|
||||
private int gridRow = 0;
|
||||
private int displayCurrenciesGridRowIndex = 0;
|
||||
private InputTextField transactionFeeInputTextField, ignoreTradersListInputTextField, ignoreDustThresholdInputTextField,
|
||||
@ -147,6 +150,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
private final OfferFilterService offerFilterService;
|
||||
private final FilterManager filterManager;
|
||||
private final DaoFacade daoFacade;
|
||||
private final boolean isBmFullNodeFromOptions;
|
||||
private final File storageDir;
|
||||
|
||||
private ListView<FiatCurrency> fiatCurrenciesListView;
|
||||
@ -154,6 +158,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
private ListView<CryptoCurrency> cryptoCurrenciesListView;
|
||||
private ComboBox<CryptoCurrency> cryptoCurrenciesComboBox;
|
||||
private Button resetDontShowAgainButton, resyncDaoFromGenesisButton, resyncDaoFromResourcesButton,
|
||||
resyncBMAccFromScratchButton, resyncBMAccFromResourcesButton,
|
||||
editCustomBtcExplorer, editCustomBsqExplorer;
|
||||
private ObservableList<String> languageCodes;
|
||||
private ObservableList<Country> countries;
|
||||
@ -169,7 +174,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
private ChangeListener<Boolean> deviationFocusedListener, bsqAverageTrimThresholdFocusedListener;
|
||||
private ChangeListener<Boolean> useCustomFeeCheckboxListener;
|
||||
private ChangeListener<Number> transactionFeeChangeListener;
|
||||
private final boolean daoOptionsSet;
|
||||
private final boolean daoFullModeFromOptionsSet;
|
||||
private final boolean displayStandbyModeFeature;
|
||||
private ChangeListener<Filter> filterChangeListener;
|
||||
|
||||
@ -188,13 +193,16 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
DaoFacade daoFacade,
|
||||
Config config,
|
||||
User user,
|
||||
BurningManAccountingService burningManAccountingService,
|
||||
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
|
||||
@Named(Config.IS_BM_FULL_NODE) boolean isBmFullNodeFromOptions,
|
||||
@Named(Config.RPC_USER) String rpcUser,
|
||||
@Named(Config.RPC_PASSWORD) String rpcPassword,
|
||||
@Named(Config.RPC_BLOCK_NOTIFICATION_PORT) int rpcBlockNotificationPort,
|
||||
@Named(Config.STORAGE_DIR) File storageDir) {
|
||||
super(model);
|
||||
this.user = user;
|
||||
this.burningManAccountingService = burningManAccountingService;
|
||||
this.formatter = formatter;
|
||||
this.preferences = preferences;
|
||||
this.feeService = feeService;
|
||||
@ -202,11 +210,12 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
this.offerFilterService = offerFilterService;
|
||||
this.filterManager = filterManager;
|
||||
this.daoFacade = daoFacade;
|
||||
this.isBmFullNodeFromOptions = isBmFullNodeFromOptions;
|
||||
this.storageDir = storageDir;
|
||||
daoOptionsSet = config.fullDaoNodeOptionSetExplicitly &&
|
||||
!rpcUser.isEmpty() &&
|
||||
!rpcPassword.isEmpty() &&
|
||||
rpcBlockNotificationPort != Config.UNSPECIFIED_PORT;
|
||||
daoFullModeFromOptionsSet = config.fullDaoNodeOptionSetExplicitly &&
|
||||
rpcUser != null && !rpcUser.isEmpty() &&
|
||||
rpcPassword != null && !rpcPassword.isEmpty() &&
|
||||
rpcBlockNotificationPort > Config.UNSPECIFIED_PORT;
|
||||
this.displayStandbyModeFeature = Utilities.isLinux() || Utilities.isOSX() || Utilities.isWindows();
|
||||
}
|
||||
|
||||
@ -676,12 +685,27 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
}
|
||||
|
||||
private void initializeDaoOptions() {
|
||||
int rowSpan = 6;
|
||||
daoOptionsTitledGroupBg = addTitledGroupBg(root, ++gridRow, rowSpan,
|
||||
daoOptionsTitledGroupBg = addTitledGroupBg(root, ++gridRow, 8,
|
||||
Res.get("setting.preferences.daoOptions"), Layout.GROUP_DISTANCE);
|
||||
|
||||
processBurningManAccountingDataToggleButton = addSlideToggleButton(root, gridRow, Res.get("setting.preferences.dao.processBurningManAccountingData"), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
|
||||
|
||||
isFullBMAccountingDataNodeToggleButton = addSlideToggleButton(root, ++gridRow, Res.get("setting.preferences.dao.isFullBMAccountingNode"));
|
||||
isFullBMAccountingDataNodeToggleButton.setManaged(preferences.isProcessBurningManAccountingData());
|
||||
isFullBMAccountingDataNodeToggleButton.setVisible(preferences.isProcessBurningManAccountingData());
|
||||
|
||||
resyncBMAccFromScratchButton = addButton(root, ++gridRow, Res.get("setting.preferences.dao.resyncBMAccFromScratch"));
|
||||
resyncBMAccFromScratchButton.setMaxWidth(Double.MAX_VALUE);
|
||||
GridPane.setHgrow(resyncBMAccFromScratchButton, Priority.ALWAYS);
|
||||
resyncBMAccFromScratchButton.setManaged(preferences.isProcessBurningManAccountingData());
|
||||
resyncBMAccFromScratchButton.setVisible(preferences.isProcessBurningManAccountingData());
|
||||
|
||||
resyncBMAccFromResourcesButton = addButton(root, ++gridRow, Res.get("setting.preferences.dao.resyncBMAccFromResources"));
|
||||
resyncBMAccFromResourcesButton.setMaxWidth(Double.MAX_VALUE);
|
||||
GridPane.setHgrow(resyncBMAccFromResourcesButton, Priority.ALWAYS);
|
||||
resyncBMAccFromResourcesButton.setManaged(preferences.isProcessBurningManAccountingData());
|
||||
resyncBMAccFromResourcesButton.setVisible(preferences.isProcessBurningManAccountingData());
|
||||
|
||||
fullModeDaoMonitorToggleButton = addSlideToggleButton(root, ++gridRow,
|
||||
Res.get("setting.preferences.dao.fullModeDaoMonitor"));
|
||||
|
||||
@ -1118,6 +1142,36 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
}
|
||||
});
|
||||
|
||||
boolean isDaoModeEnabled = isDaoModeEnabled();
|
||||
boolean isFullBMAccountingNode = (isBmFullNodeFromOptions || preferences.isFullBMAccountingNode()) && isDaoModeEnabled;
|
||||
preferences.setFullBMAccountingNode(isFullBMAccountingNode);
|
||||
isFullBMAccountingDataNodeToggleButton.setSelected(isFullBMAccountingNode);
|
||||
|
||||
isFullBMAccountingDataNodeToggleButton.setOnAction(e -> {
|
||||
if (isFullBMAccountingDataNodeToggleButton.isSelected()) {
|
||||
if (isDaoModeEnabled()) {
|
||||
new Popup().attention(Res.get("setting.preferences.dao.useFullBMAccountingNode.enabledDaoMode.popup"))
|
||||
.actionButtonText(Res.get("shared.yes"))
|
||||
.onAction(() -> {
|
||||
preferences.setFullBMAccountingNode(true);
|
||||
UserThread.runAfter(BisqApp.getShutDownHandler(), 500, TimeUnit.MILLISECONDS);
|
||||
})
|
||||
.closeButtonText(Res.get("shared.cancel"))
|
||||
.onClose(() -> isFullBMAccountingDataNodeToggleButton.setSelected(false))
|
||||
.show();
|
||||
} else {
|
||||
new Popup().attention(Res.get("setting.preferences.dao.useFullBMAccountingNode.noDaoMode.popup"))
|
||||
.actionButtonText(Res.get("shared.ok"))
|
||||
.onAction(() -> isFullBMAccountingDataNodeToggleButton.setSelected(false))
|
||||
.onClose(() -> isFullBMAccountingDataNodeToggleButton.setSelected(false))
|
||||
.show();
|
||||
}
|
||||
} else {
|
||||
preferences.setFullBMAccountingNode(false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
fullModeDaoMonitorToggleButton.setSelected(preferences.isUseFullModeDaoMonitor());
|
||||
fullModeDaoMonitorToggleButton.setOnAction(e -> {
|
||||
preferences.setUseFullModeDaoMonitor(fullModeDaoMonitorToggleButton.isSelected());
|
||||
@ -1133,8 +1187,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
}
|
||||
});
|
||||
|
||||
boolean daoFullNode = preferences.isDaoFullNode();
|
||||
isDaoFullNodeToggleButton.setSelected(daoFullNode);
|
||||
isDaoFullNodeToggleButton.setSelected(isDaoModeEnabled);
|
||||
|
||||
bsqAverageTrimThresholdTextField.textProperty().addListener(bsqAverageTrimThresholdListener);
|
||||
bsqAverageTrimThresholdTextField.focusedProperty().addListener(bsqAverageTrimThresholdFocusedListener);
|
||||
@ -1142,9 +1195,10 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
String rpcUser = preferences.getRpcUser();
|
||||
String rpcPw = preferences.getRpcPw();
|
||||
int blockNotifyPort = preferences.getBlockNotifyPort();
|
||||
if (daoFullNode && (rpcUser == null || rpcUser.isEmpty() ||
|
||||
rpcPw == null || rpcPw.isEmpty() ||
|
||||
blockNotifyPort <= 0)) {
|
||||
boolean rpcDataFromPrefSet = rpcUser != null && !rpcUser.isEmpty() &&
|
||||
rpcPw != null && !rpcPw.isEmpty() &&
|
||||
blockNotifyPort > 0;
|
||||
if (!daoFullModeFromOptionsSet && !rpcDataFromPrefSet) {
|
||||
log.warn("You have full DAO node selected but have not provided the rpc username, password and " +
|
||||
"block notify port. We reset daoFullNode to false");
|
||||
isDaoFullNodeToggleButton.setSelected(false);
|
||||
@ -1175,6 +1229,23 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
.closeButtonText(Res.get("shared.cancel"))
|
||||
.show());
|
||||
|
||||
resyncBMAccFromScratchButton.setOnAction(e ->
|
||||
new Popup().attention(Res.get("setting.preferences.dao.resyncBMAccFromScratch.popup"))
|
||||
.actionButtonText(Res.get("setting.preferences.dao.resyncBMAccFromScratch.resync"))
|
||||
.onAction(() -> burningManAccountingService.resyncAccountingDataFromScratch(BisqApp::getShutDownHandler))
|
||||
.closeButtonText(Res.get("shared.cancel"))
|
||||
.show());
|
||||
|
||||
resyncBMAccFromResourcesButton.setOnAction(e ->
|
||||
new Popup().attention(Res.get("setting.preferences.dao.resyncBMAccFromResources.popup"))
|
||||
.actionButtonText(Res.get("setting.preferences.dao.resyncBMAccFromResources.resync"))
|
||||
.onAction(() -> {
|
||||
burningManAccountingService.resyncAccountingDataFromResources();
|
||||
UserThread.runAfter(BisqApp.getShutDownHandler(), 500, TimeUnit.MILLISECONDS);
|
||||
})
|
||||
.closeButtonText(Res.get("shared.cancel"))
|
||||
.show());
|
||||
|
||||
isDaoFullNodeToggleButton.setOnAction(e -> {
|
||||
String key = "daoFullModeInfoShown";
|
||||
if (isDaoFullNodeToggleButton.isSelected() && preferences.showAgain(key)) {
|
||||
@ -1191,7 +1262,6 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
.width(800)
|
||||
.show();
|
||||
}
|
||||
|
||||
updateDaoFields();
|
||||
});
|
||||
|
||||
@ -1200,6 +1270,17 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
blockNotifyPortTextField.textProperty().addListener(blockNotifyPortListener);
|
||||
}
|
||||
|
||||
private boolean isDaoModeEnabled() {
|
||||
String rpcUser = preferences.getRpcUser();
|
||||
String rpcPw = preferences.getRpcPw();
|
||||
int blockNotifyPort = preferences.getBlockNotifyPort();
|
||||
boolean rpcDataFromPrefSet = rpcUser != null && !rpcUser.isEmpty() &&
|
||||
rpcPw != null && !rpcPw.isEmpty() &&
|
||||
blockNotifyPort > 0;
|
||||
boolean daoFullModeFromPrefSet = rpcDataFromPrefSet && preferences.isDaoFullNode();
|
||||
return daoFullModeFromPrefSet || daoFullModeFromOptionsSet;
|
||||
}
|
||||
|
||||
private void activateAutoConfirmPreferences() {
|
||||
preferences.findAutoConfirmSettings("XMR").ifPresent(autoConfirmSettings -> {
|
||||
autoConfirmXmrToggle.setSelected(autoConfirmSettings.isEnabled());
|
||||
@ -1240,7 +1321,14 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
|
||||
private void updateDaoFields() {
|
||||
boolean isDaoFullNode = isDaoFullNodeToggleButton.isSelected();
|
||||
GridPane.setRowSpan(daoOptionsTitledGroupBg, isDaoFullNode ? 9 : 6);
|
||||
int rowSpan = 9;
|
||||
if (isDaoFullNode) {
|
||||
rowSpan += 3;
|
||||
}
|
||||
if (preferences.isProcessBurningManAccountingData()) {
|
||||
rowSpan += 3;
|
||||
}
|
||||
GridPane.setRowSpan(daoOptionsTitledGroupBg, rowSpan);
|
||||
rpcUserTextField.setVisible(isDaoFullNode);
|
||||
rpcUserTextField.setManaged(isDaoFullNode);
|
||||
rpcPwTextField.setVisible(isDaoFullNode);
|
||||
@ -1252,12 +1340,14 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
rpcUserTextField.clear();
|
||||
rpcPwTextField.clear();
|
||||
blockNotifyPortTextField.clear();
|
||||
preferences.setFullBMAccountingNode(false);
|
||||
isFullBMAccountingDataNodeToggleButton.setSelected(false);
|
||||
}
|
||||
|
||||
isDaoFullNodeToggleButton.setDisable(daoOptionsSet);
|
||||
rpcUserTextField.setDisable(daoOptionsSet);
|
||||
rpcPwTextField.setDisable(daoOptionsSet);
|
||||
blockNotifyPortTextField.setDisable(daoOptionsSet);
|
||||
isDaoFullNodeToggleButton.setDisable(daoFullModeFromOptionsSet);
|
||||
rpcUserTextField.setDisable(daoFullModeFromOptionsSet);
|
||||
rpcPwTextField.setDisable(daoFullModeFromOptionsSet);
|
||||
blockNotifyPortTextField.setDisable(daoFullModeFromOptionsSet);
|
||||
}
|
||||
|
||||
|
||||
@ -1304,9 +1394,12 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
|
||||
private void deactivateDaoPreferences() {
|
||||
processBurningManAccountingDataToggleButton.setOnAction(null);
|
||||
isFullBMAccountingDataNodeToggleButton.setOnAction(null);
|
||||
fullModeDaoMonitorToggleButton.setOnAction(null);
|
||||
resyncDaoFromResourcesButton.setOnAction(null);
|
||||
resyncDaoFromGenesisButton.setOnAction(null);
|
||||
resyncBMAccFromScratchButton.setOnAction(null);
|
||||
resyncBMAccFromResourcesButton.setOnAction(null);
|
||||
bsqAverageTrimThresholdTextField.textProperty().removeListener(bsqAverageTrimThresholdListener);
|
||||
bsqAverageTrimThresholdTextField.focusedProperty().removeListener(bsqAverageTrimThresholdFocusedListener);
|
||||
isDaoFullNodeToggleButton.setOnAction(null);
|
||||
|
@ -1972,6 +1972,7 @@ message PreferencesPayload {
|
||||
int64 user_defined_trade_limit = 67;
|
||||
bool user_has_raised_trade_limit = 68;
|
||||
bool process_burning_man_accounting_data = 69;
|
||||
bool is_full_b_m_accounting_node = 70;
|
||||
}
|
||||
|
||||
message AutoConfirmSettings {
|
||||
|
Loading…
Reference in New Issue
Block a user