From 3c1e0f2aef01f7a4518506ac09c991b8594705c7 Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Wed, 21 Nov 2018 02:14:14 +0000 Subject: [PATCH] lnwallet/btcwallet: return best header timestamp while wallet is rescanning. One way applications built on top of lnd can estimate sync percentage is through comparing the current time to the best known timestamp of the lnd wallet's sync state. Therefore, we should always return this information even if the the wallet is not synced. --- lnwallet/btcwallet/btcwallet.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lnwallet/btcwallet/btcwallet.go b/lnwallet/btcwallet/btcwallet.go index 2341ba5d..ded8fb2f 100644 --- a/lnwallet/btcwallet/btcwallet.go +++ b/lnwallet/btcwallet/btcwallet.go @@ -714,11 +714,6 @@ func (b *BtcWallet) SubscribeTransactions() (lnwallet.TransactionSubscription, e // // This is a part of the WalletController interface. func (b *BtcWallet) IsSynced() (bool, int64, error) { - // First, we'll ensure the wallet is not currently undergoing a rescan. - if !b.wallet.ChainSynced() { - return false, 0, nil - } - // Grab the best chain state the wallet is currently aware of. syncState := b.wallet.Manager.SyncedTo() @@ -735,7 +730,7 @@ func (b *BtcWallet) IsSynced() (bool, int64, error) { // If the wallet hasn't yet fully synced to the node's best chain tip, // then we're not yet fully synced. - if syncState.Height < bestHeight { + if syncState.Height < bestHeight || !b.wallet.ChainSynced() { return false, bestTimestamp, nil }