From e2b3a23663393f5101a0a38086ca0911568ed427 Mon Sep 17 00:00:00 2001
From: Martin Holst Swende <martin@swende.se>
Date: Mon, 20 Nov 2017 12:35:30 +0100
Subject: [PATCH] accounts/keystore: Ignore initial trigger of rescan-event

---
 accounts/keystore/watch.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/accounts/keystore/watch.go b/accounts/keystore/watch.go
index 602300b10..bbcfb9925 100644
--- a/accounts/keystore/watch.go
+++ b/accounts/keystore/watch.go
@@ -81,10 +81,14 @@ func (w *watcher) loop() {
 	// When an event occurs, the reload call is delayed a bit so that
 	// multiple events arriving quickly only cause a single reload.
 	var (
-		debounce         = time.NewTimer(0)
 		debounceDuration = 500 * time.Millisecond
 		rescanTriggered  = false
+		debounce         = time.NewTimer(0)
 	)
+	// Ignore initial trigger
+	if !debounce.Stop() {
+		<-debounce.C
+	}
 	defer debounce.Stop()
 	for {
 		select {
-- 
GitLab