Skip to content

Commit

Permalink
Start server at onInitWallet and add wallet password handler
Browse files Browse the repository at this point in the history
- Add onInitWallet to HttpApiMain and start http server there
- Add onRequestWalletPassword to BisqSetupListener
- Override setupHandlers in HttpApiHeadlessApp and adjust
setRequestWalletPasswordHandler (impl. missing)
- Add onRequestWalletPassword to HttpApiMain
  • Loading branch information
ManfredKarrer authored and Bernard Labno committed Oct 5, 2019
1 parent b6cc351 commit fb9f59d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/java/bisq/core/app/BisqHeadlessApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class BisqHeadlessApp implements HeadlessApp {
@Setter
private GracefulShutDownHandler gracefulShutDownHandler;
private boolean shutDownRequested;
private BisqSetup bisqSetup;
protected BisqSetup bisqSetup;
private CorruptedDatabaseFilesHandler corruptedDatabaseFilesHandler;
private TradeManager tradeManager;

Expand Down
9 changes: 9 additions & 0 deletions core/src/main/java/bisq/core/app/BisqSetup.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ default void onInitWallet() {
log.info("onInitWallet");
}

default void onRequestWalletPassword() {
log.info("onRequestWalletPassword");
}

void onSetupComplete();
}

Expand Down Expand Up @@ -561,6 +565,8 @@ else if (displayTorNetworkSettingsHandler != null)
private void initWallet() {
bisqSetupListeners.forEach(BisqSetupListener::onInitWallet);
Runnable walletPasswordHandler = () -> {
log.info("Wallet password required");
bisqSetupListeners.forEach(BisqSetupListener::onRequestWalletPassword);
if (p2pNetworkReady.get())
p2PNetworkSetup.setSplashP2PNetworkAnimationVisible(true);

Expand All @@ -571,6 +577,9 @@ private void initWallet() {
if (showFirstPopupIfResyncSPVRequestedHandler != null)
showFirstPopupIfResyncSPVRequestedHandler.run();
} else {
// TODO no guarantee here that the wallet is really fully initialized
// We would need a new walletInitializedButNotEncrypted state to track
// Usually init is fast and we have our wallet initialized at that state though.
walletInitialized.set(true);
}
});
Expand Down

0 comments on commit fb9f59d

Please sign in to comment.