Block UI popups in api startup's encrypted wallet init

Running the UI's walletPasswordHandler during wallet initialization will fail
and block wallet initialization.  This change ensures an encrypted wallet
does not trigger a walletPasswordHandler.run() if isApiUser=true during startup.
This commit is contained in:
ghubstan 2021-03-20 18:22:52 -03:00 committed by Christoph Atteneder
parent 0fd7efd80f
commit dd2b17fde7
No known key found for this signature in database
GPG key ID: CD5DC1C529CDFD3B

View file

@ -17,6 +17,7 @@
package bisq.core.app;
import bisq.core.api.CoreContext;
import bisq.core.btc.exceptions.InvalidHostException;
import bisq.core.btc.exceptions.RejectedTxException;
import bisq.core.btc.setup.WalletsSetup;
@ -63,6 +64,7 @@ import javax.annotation.Nullable;
@Singleton
public class WalletAppSetup {
private final CoreContext coreContext;
private final WalletsManager walletsManager;
private final WalletsSetup walletsSetup;
private final FeeService feeService;
@ -86,11 +88,13 @@ public class WalletAppSetup {
private final BooleanProperty useTorForBTC = new SimpleBooleanProperty();
@Inject
public WalletAppSetup(WalletsManager walletsManager,
public WalletAppSetup(CoreContext coreContext,
WalletsManager walletsManager,
WalletsSetup walletsSetup,
FeeService feeService,
Config config,
Preferences preferences) {
this.coreContext = coreContext;
this.walletsManager = walletsManager;
this.walletsSetup = walletsSetup;
this.feeService = feeService;
@ -172,10 +176,10 @@ public class WalletAppSetup {
walletsSetup.initialize(null,
() -> {
// We only check one wallet as we apply encryption to all or none
if (walletsManager.areWalletsEncrypted()) {
if (walletsManager.areWalletsEncrypted() && !coreContext.isApiUser()) {
walletPasswordHandler.run();
} else {
if (preferences.isResyncSpvRequested()) {
if (preferences.isResyncSpvRequested() && !coreContext.isApiUser()) {
if (showFirstPopupIfResyncSPVRequestedHandler != null)
showFirstPopupIfResyncSPVRequestedHandler.run();
} else {