From e93df8273b23c3aa7e94e270348b730af3422559 Mon Sep 17 00:00:00 2001 From: Bitcoin Hodler Date: Sun, 27 Dec 2020 19:45:44 +0000 Subject: [PATCH 1/4] Fix grammar errors in README "It's" means "it is". --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 85b02a7f..940df348 100644 --- a/README.md +++ b/README.md @@ -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 -------- | -------- From d722c4972a55ec5ae4e347ab3e1d07554cf94f23 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Fri, 1 Jan 2021 10:40:08 +0200 Subject: [PATCH 2/4] initialise logger after configuring user defined application home --- drongo | 2 +- src/main/java/com/sparrowwallet/sparrow/MainApp.java | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drongo b/drongo index 05674097..962253be 160000 --- a/drongo +++ b/drongo @@ -1 +1 @@ -Subproject commit 05674097428d25de043310f8ecddf06d998b3943 +Subproject commit 962253beaacfe36b5fb3261bae60b4e126406c19 diff --git a/src/main/java/com/sparrowwallet/sparrow/MainApp.java b/src/main/java/com/sparrowwallet/sparrow/MainApp.java index ad545a55..235c562b 100644 --- a/src/main/java/com/sparrowwallet/sparrow/MainApp.java +++ b/src/main/java/com/sparrowwallet/sparrow/MainApp.java @@ -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"; @@ -109,8 +107,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) { @@ -121,7 +119,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); } } } @@ -132,9 +130,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); + } } From 94897e9744d2d5024ba984a24fa7332839f8de65 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Fri, 1 Jan 2021 16:15:52 +0200 Subject: [PATCH 3/4] remove folder --- drongo | 2 +- ~/.sparrow-peak/config | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) delete mode 100644 ~/.sparrow-peak/config diff --git a/drongo b/drongo index 962253be..4da2c024 160000 --- a/drongo +++ b/drongo @@ -1 +1 @@ -Subproject commit 962253beaacfe36b5fb3261bae60b4e126406c19 +Subproject commit 4da2c024d4fbe3ecbca9772a0761def6d5269c38 diff --git a/~/.sparrow-peak/config b/~/.sparrow-peak/config deleted file mode 100644 index 9abaecf5..00000000 --- a/~/.sparrow-peak/config +++ /dev/null @@ -1,10 +0,0 @@ -{ - "mode": "OFFLINE", - "bitcoinUnit": "AUTO", - "groupByAddress": true, - "includeMempoolChange": true, - "notifyNewTransactions": true, - "checkNewVersions": true, - "theme": "LIGHT", - "useProxy": false -} \ No newline at end of file From 901a4520fdc15bb3fb8af88243d77a231d809d67 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Fri, 8 Jan 2021 16:11:36 +0200 Subject: [PATCH 4/4] safe multithreading config writes --- src/main/java/com/sparrowwallet/sparrow/io/Config.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/io/Config.java b/src/main/java/com/sparrowwallet/sparrow/io/Config.java index d5eee569..2ea4b518 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/Config.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/Config.java @@ -277,12 +277,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