Skip to content

Commit

Permalink
Merge pull request #4067 from dmos62/revert-localbitcoinnode-to-socke…
Browse files Browse the repository at this point in the history
…t-opening

 Revert to only check local BTC node's port
  • Loading branch information
ripcurlx authored Mar 16, 2020
2 parents a7e6b99 + 646f23e commit e13ffe6
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 330 deletions.
40 changes: 8 additions & 32 deletions core/src/main/java/bisq/core/app/BisqSetup.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ default void onRequestWalletPassword() {

@Setter
@Nullable
private Consumer<Runnable> displayTacHandler, displayLocalNodeMisconfigurationHandler;
private Consumer<Runnable> displayTacHandler;
@Setter
@Nullable
private Consumer<String> cryptoSetupFailedHandler, chainFileLockedExceptionHandler,
Expand Down Expand Up @@ -343,25 +343,21 @@ public void start() {
UserThread.runPeriodically(() -> {
}, 1);
maybeReSyncSPVChain();
maybeShowTac();
maybeShowTac(this::step2);
}

private void step2() {
maybeCheckLocalBitcoinNode(this::step3);
}

private void step3() {
torSetup.cleanupTorFiles();
readMapsFromResources(this::step4);
readMapsFromResources(this::step3);
checkCryptoSetup();
checkForCorrectOSArchitecture();
}

private void step4() {
startP2pNetworkAndWallet(this::step5);
private void step3() {
startP2pNetworkAndWallet(this::step4);
}

private void step5() {
private void step4() {
initDomainServices();

bisqSetupListeners.forEach(BisqSetupListener::onSetupComplete);
Expand Down Expand Up @@ -469,36 +465,16 @@ private void maybeReSyncSPVChain() {
}
}

private void maybeShowTac() {
private void maybeShowTac(Runnable nextStep) {
if (!preferences.isTacAcceptedV120() && !DevEnv.isDevMode()) {
if (displayTacHandler != null)
displayTacHandler.accept(() -> {
preferences.setTacAcceptedV120(true);
step2();
nextStep.run();
});
} else {
step2();
}
}

private void maybeCheckLocalBitcoinNode(Runnable nextStep) {
if (localBitcoinNode.shouldBeIgnored()) {
nextStep.run();
return;
}

// Here we only want to provide the user with a choice (in a popup) in case a
// local node is detected, but badly configured.
if (localBitcoinNode.isDetectedButMisconfigured()) {
if (displayLocalNodeMisconfigurationHandler != null) {
displayLocalNodeMisconfigurationHandler.accept(nextStep);
return;
} else {
log.error("displayLocalNodeMisconfigurationHandler undefined", new RuntimeException());
}
}

nextStep.run();
}

private void readMapsFromResources(Runnable nextStep) {
Expand Down
Loading

0 comments on commit e13ffe6

Please sign in to comment.