lnwallet/btcwallet: check wallet rescan is complete within IsSynced

In this commit, we add an additional check to btcwallet's IsSynced
method to ensure that it is not currently undergoing a rescan. We do
this to block upon starting the server and all other dependent
subsystems until the rescan is complete.
This commit is contained in:
Wilmer Paulino 2018-11-13 20:08:54 -08:00
parent b1860a95e0
commit 9ca9802d9c
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

@ -714,6 +714,11 @@ 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()