Commit aea1b7b7 authored by zeroleak's avatar zeroleak
Browse files

add cliConfig.resync

parent 3d8dfd2b
......@@ -96,6 +96,11 @@ public class ApplicationArgs {
if (valueInt != null) {
cliConfig.getMix().setMixsTarget(valueInt);
}
valueBool = optionalBoolean(ARG_RESYNC);
if (valueBool != null) {
cliConfig.setResync(valueBool);
}
}
public boolean isListPools() {
......
......@@ -19,6 +19,7 @@ import org.springframework.util.StringUtils;
public class CliConfig extends CliConfigFile {
private boolean autoAggregatePostmix;
private String autoTx0PoolId;
private boolean resync;
public CliConfig() {
super();
......@@ -57,6 +58,14 @@ public class CliConfig extends CliConfigFile {
this.autoTx0PoolId = autoTx0PoolId;
}
public boolean isResync() {
return resync;
}
public void setResync(boolean resync) {
this.resync = resync;
}
@Override
public Map<String, String> getConfigInfo() {
Map<String, String> configInfo = super.getConfigInfo();
......@@ -74,6 +83,7 @@ public class CliConfig extends CliConfigFile {
"cli/proxy", getCliProxy().isPresent() ? getCliProxy().get().toString() : "null");
configInfo.put("cli/autoAggregatePostmix", Boolean.toString(autoAggregatePostmix));
configInfo.put("cli/autoTx0PoolId", autoTx0PoolId != null ? autoTx0PoolId : "null");
configInfo.put("cli/resync", Boolean.toString(resync));
return configInfo;
}
......
......@@ -200,11 +200,6 @@ public class CliService {
new RunCliCommand(appArgs, cliWalletService, walletAggregateService).run();
return CliResult.EXIT_SUCCESS;
} else {
// resync?
if (appArgs.isResync()) {
cliWallet.resync();
}
// start wallet
cliWallet.start();
keepRunning();
......
......@@ -52,7 +52,11 @@ public class CliUpgradeService {
@Override
public boolean run(CliWallet cliWallet) throws Exception {
// resync postmix counters
cliWallet.resync();
try {
cliWallet.resync();
} catch (Exception e) {
log.error("", e);
}
return false;
}
});
......
......@@ -147,7 +147,7 @@ public class CliWalletService extends WhirlpoolWalletService {
walletAggregateService,
cliTorClientService,
httpClientService);
CliWallet result = (CliWallet) openWallet(cliWallet);
cliWallet = (CliWallet) openWallet(cliWallet);
// check upgrade
boolean shouldRestart = cliUpgradeService.upgradeAuthenticated(cliWallet);
......@@ -159,7 +159,16 @@ public class CliWalletService extends WhirlpoolWalletService {
log.warn(CliUtils.LOG_SEPARATOR);
throw new CliRestartException("Upgrade success, restarting CLI...");
}
return result;
// resync?
if (cliConfig.isResync()) {
try {
cliWallet.resync();
} catch (Exception e) {
log.error("", e);
}
}
return cliWallet;
}
private BackendApi computeBackendApiService(String passphrase) throws Exception {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment