mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-10 07:30:05 -04:00
repurpose delete spv button to rescan outputs (hidden w/o implementation)
This commit is contained in:
parent
b87bf74453
commit
37c6f36868
22 changed files with 23 additions and 187 deletions
|
@ -76,7 +76,6 @@ public class HavenoHeadlessApp implements HeadlessApp {
|
|||
acceptedHandler.run();
|
||||
});
|
||||
havenoSetup.setDisplayTorNetworkSettingsHandler(show -> log.info("onDisplayTorNetworkSettingsHandler: show={}", show));
|
||||
havenoSetup.setSpvFileCorruptedHandler(msg -> log.error("onSpvFileCorruptedHandler: msg={}", msg));
|
||||
havenoSetup.setChainFileLockedExceptionHandler(msg -> log.error("onChainFileLockedExceptionHandler: msg={}", msg));
|
||||
havenoSetup.setLockedUpFundsHandler(msg -> log.info("onLockedUpFundsHandler: msg={}", msg));
|
||||
havenoSetup.setShowFirstPopupIfResyncSPVRequestedHandler(() -> log.info("onShowFirstPopupIfResyncSPVRequestedHandler"));
|
||||
|
|
|
@ -98,7 +98,6 @@ import java.util.function.Consumer;
|
|||
@Singleton
|
||||
public class HavenoSetup {
|
||||
private static final String VERSION_FILE_NAME = "version";
|
||||
private static final String RESYNC_SPV_FILE_NAME = "resyncSpv";
|
||||
|
||||
private static final long STARTUP_TIMEOUT_MINUTES = 5;
|
||||
|
||||
|
@ -132,8 +131,8 @@ public class HavenoSetup {
|
|||
@Setter
|
||||
@Nullable
|
||||
private Consumer<String> chainFileLockedExceptionHandler,
|
||||
spvFileCorruptedHandler, lockedUpFundsHandler,
|
||||
filterWarningHandler, displaySecurityRecommendationHandler, displayLocalhostHandler,
|
||||
lockedUpFundsHandler, filterWarningHandler,
|
||||
displaySecurityRecommendationHandler, displayLocalhostHandler,
|
||||
wrongOSArchitectureHandler, displaySignedByArbitratorHandler,
|
||||
displaySignedByPeerHandler, displayPeerLimitLiftedHandler, displayPeerSignerHandler,
|
||||
rejectedTxErrorMessageHandler;
|
||||
|
@ -291,7 +290,6 @@ public class HavenoSetup {
|
|||
}
|
||||
|
||||
persistHavenoVersion();
|
||||
maybeReSyncSPVChain();
|
||||
maybeShowTac(this::step2);
|
||||
}
|
||||
|
||||
|
@ -326,19 +324,6 @@ public class HavenoSetup {
|
|||
// Sub tasks
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void maybeReSyncSPVChain() {
|
||||
// We do the delete of the spv file at startup before BitcoinJ is initialized to avoid issues with locked files under Windows.
|
||||
if (getResyncSpvSemaphore()) {
|
||||
try {
|
||||
walletsSetup.reSyncSPVChain();
|
||||
|
||||
} catch (IOException e) {
|
||||
log.error(e.toString());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void maybeShowTac(Runnable nextStep) {
|
||||
if (!preferences.isTacAcceptedV120() && !DevEnv.isDevMode()) {
|
||||
if (displayTacHandler != null)
|
||||
|
@ -430,8 +415,6 @@ public class HavenoSetup {
|
|||
log.info("Init wallet");
|
||||
havenoSetupListeners.forEach(HavenoSetupListener::onInitWallet);
|
||||
walletAppSetup.init(chainFileLockedExceptionHandler,
|
||||
spvFileCorruptedHandler,
|
||||
getResyncSpvSemaphore(),
|
||||
showFirstPopupIfResyncSPVRequestedHandler,
|
||||
showPopupIfInvalidBtcConfigHandler,
|
||||
() -> {
|
||||
|
@ -532,32 +515,6 @@ public class HavenoSetup {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static boolean getResyncSpvSemaphore() {
|
||||
File resyncSpvSemaphore = new File(Config.appDataDir(), RESYNC_SPV_FILE_NAME);
|
||||
return resyncSpvSemaphore.exists();
|
||||
}
|
||||
|
||||
public static void setResyncSpvSemaphore(boolean isResyncSpvRequested) {
|
||||
File resyncSpvSemaphore = new File(Config.appDataDir(), RESYNC_SPV_FILE_NAME);
|
||||
if (isResyncSpvRequested) {
|
||||
if (!resyncSpvSemaphore.exists()) {
|
||||
try {
|
||||
if (!resyncSpvSemaphore.createNewFile()) {
|
||||
log.error("ResyncSpv file could not be created");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error("ResyncSpv file could not be created. {}", e.toString());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
resyncSpvSemaphore.delete();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static File getVersionFile() {
|
||||
return new File(Config.appDataDir(), VERSION_FILE_NAME);
|
||||
}
|
||||
|
|
|
@ -99,8 +99,6 @@ public class WalletAppSetup {
|
|||
}
|
||||
|
||||
void init(@Nullable Consumer<String> chainFileLockedExceptionHandler,
|
||||
@Nullable Consumer<String> spvFileCorruptedHandler,
|
||||
boolean isSpvResyncRequested,
|
||||
@Nullable Runnable showFirstPopupIfResyncSPVRequestedHandler,
|
||||
@Nullable Runnable showPopupIfInvalidBtcConfigHandler,
|
||||
Runnable downloadCompleteHandler,
|
||||
|
@ -149,8 +147,6 @@ public class WalletAppSetup {
|
|||
} else if (exception.getCause() instanceof BlockStoreException) {
|
||||
if (exception.getCause().getCause() instanceof ChainFileLockedException && chainFileLockedExceptionHandler != null) {
|
||||
chainFileLockedExceptionHandler.accept(Res.get("popup.warning.startupFailed.twoInstances"));
|
||||
} else if (spvFileCorruptedHandler != null) {
|
||||
spvFileCorruptedHandler.accept(Res.get("error.spvFileCorrupted", exception.getMessage()));
|
||||
}
|
||||
} else if (exception instanceof RejectedTxException) {
|
||||
rejectedTxException.set((RejectedTxException) exception);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue