From eef81a4124c25e0deec562a94d2bfd7eef05c5a2 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Wed, 6 Feb 2019 11:26:20 +0100 Subject: [PATCH] wallet/wallet: assume not current if best height is 0 This is done to avoid the birthday rescan to fail if the chain backend reports a bestheight of 0. Earlier it could happen that we attempted to sync to the birthday, but since only the genesis block was available, which would be rejected as birthday block because of the timestamp, it would fail to find a block and the sync would fail. --- wallet/wallet.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wallet/wallet.go b/wallet/wallet.go index 221e6a1..b823d90 100644 --- a/wallet/wallet.go +++ b/wallet/wallet.go @@ -471,6 +471,12 @@ func (w *Wallet) scanChain(startHeight int32, Checkpoints[len(w.chainParams.Checkpoints)-1].Height } isCurrent := func(bestHeight int32) bool { + // If the best height is zero, we assume the chain backend + // still is looking for peers to sync to. + if bestHeight == 0 { + return false + } + switch c := chainClient.(type) { case *chain.NeutrinoClient: return c.CS.IsCurrent()