mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 09:48:19 +01:00
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.
This commit is contained in:
parent
d3b44542d3
commit
3c1e0f2aef
1 changed files with 1 additions and 6 deletions
|
@ -714,11 +714,6 @@ func (b *BtcWallet) SubscribeTransactions() (lnwallet.TransactionSubscription, e
|
||||||
//
|
//
|
||||||
// This is a part of the WalletController interface.
|
// This is a part of the WalletController interface.
|
||||||
func (b *BtcWallet) IsSynced() (bool, int64, error) {
|
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.
|
// Grab the best chain state the wallet is currently aware of.
|
||||||
syncState := b.wallet.Manager.SyncedTo()
|
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,
|
// If the wallet hasn't yet fully synced to the node's best chain tip,
|
||||||
// then we're not yet fully synced.
|
// then we're not yet fully synced.
|
||||||
if syncState.Height < bestHeight {
|
if syncState.Height < bestHeight || !b.wallet.ChainSynced() {
|
||||||
return false, bestTimestamp, nil
|
return false, bestTimestamp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue