Merge branch 'master' into bwt

This commit is contained in:
Craig Raw 2021-01-08 17:01:32 +02:00
commit 72281233e1
4 changed files with 11 additions and 18 deletions

View file

@ -32,7 +32,7 @@ Java 14 must be installed.
## Configuration
Sparrow has a number of command line options, for example to change it's home folder or use testnet:
Sparrow has a number of command line options, for example to change its home folder or use testnet:
```
./sparrow -h
@ -56,7 +56,7 @@ A final fallback which can be useful when running the Sparrow binary is to creat
Note that if you are connecting to an Electrum server when using testnet, that server will need to running on testnet configuration as well.
When not explicitly configured using the command line argument above, Sparrow stores it's mainnet config file, log file and wallets in a home folder location appropriate to the operating system:
When not explicitly configured using the command line argument above, Sparrow stores its mainnet config file, log file and wallets in a home folder location appropriate to the operating system:
Platform | Location
-------- | --------

View file

@ -28,8 +28,6 @@ import java.util.*;
import java.util.stream.Collectors;
public class MainApp extends Application {
private static final Logger log = LoggerFactory.getLogger(MainApp.class);
public static final String APP_NAME = "Sparrow";
public static final String APP_VERSION = "0.9.9";
public static final String APP_HOME_PROPERTY = "sparrow.home";
@ -110,8 +108,8 @@ public class MainApp extends Application {
}
if(args.dir != null) {
log.info("Using configured Sparrow home folder of " + args.dir);
System.setProperty(APP_HOME_PROPERTY, args.dir);
getLogger().info("Using configured Sparrow home folder of " + args.dir);
}
if(args.network != null) {
@ -122,7 +120,7 @@ public class MainApp extends Application {
try {
Network.set(Network.valueOf(envNetwork.toUpperCase()));
} catch(Exception e) {
log.warn("Invalid " + NETWORK_ENV_PROPERTY + " property: " + envNetwork);
getLogger().warn("Invalid " + NETWORK_ENV_PROPERTY + " property: " + envNetwork);
}
}
}
@ -133,9 +131,13 @@ public class MainApp extends Application {
}
if(Network.get() != Network.MAINNET) {
log.info("Using " + Network.get() + " configuration");
getLogger().info("Using " + Network.get() + " configuration");
}
com.sun.javafx.application.LauncherImpl.launchApplication(MainApp.class, MainAppPreloader.class, argv);
}
private static Logger getLogger() {
return LoggerFactory.getLogger(MainApp.class);
}
}

View file

@ -343,12 +343,13 @@ public class Config {
flush();
}
private void flush() {
private synchronized void flush() {
Gson gson = getGson();
try {
File configFile = getConfigFile();
Writer writer = new FileWriter(configFile);
gson.toJson(this, writer);
writer.flush();
writer.close();
} catch (IOException e) {
//Ignore

View file

@ -1,10 +0,0 @@
{
"mode": "OFFLINE",
"bitcoinUnit": "AUTO",
"groupByAddress": true,
"includeMempoolChange": true,
"notifyNewTransactions": true,
"checkNewVersions": true,
"theme": "LIGHT",
"useProxy": false
}