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.
This commit is contained in:
parent
ba03278a64
commit
eef81a4124
1 changed files with 6 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue