From 7cd38bc77a161b91b18f5494cd4d2fb0f14c79b3 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 26 Jun 2013 23:15:01 +0200 Subject: [PATCH] Wallet: Enable autoSaveListener for 0-delay autosave. --- core/src/main/java/com/google/bitcoin/core/Wallet.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/com/google/bitcoin/core/Wallet.java b/core/src/main/java/com/google/bitcoin/core/Wallet.java index c166b8ed..379f3c0b 100644 --- a/core/src/main/java/com/google/bitcoin/core/Wallet.java +++ b/core/src/main/java/com/google/bitcoin/core/Wallet.java @@ -628,8 +628,8 @@ public class Wallet implements Serializable, BlockChainListener { try { Preconditions.checkArgument(delayTime >= 0); autosaveToFile = Preconditions.checkNotNull(f); + autosaveEventListener = eventListener; if (delayTime > 0) { - autosaveEventListener = eventListener; autosaveDelayMs = TimeUnit.MILLISECONDS.convert(delayTime, timeUnit); } } finally { @@ -643,11 +643,7 @@ public class Wallet implements Serializable, BlockChainListener { if (this.autosaveToFile == null) return; if (autosaveDelayMs == 0) { // No delay time was specified, so save now. - try { - saveToFile(autosaveToFile); - } catch (IOException e) { - throw new RuntimeException(e); - } + autoSave(); } else { // If we need to, tell the auto save thread to wake us up. This will start the background thread if one // doesn't already exist. It will wake up once the delay expires and call autoSave().