Merge pull request #628 from cfromknecht/faster-btcd-init

wallet: speed up bare wallet init when using the btcd backend
This commit is contained in:
Olaoluwa Osuntokun 2019-06-28 15:53:30 -07:00 committed by GitHub
commit 4a9774585e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -359,17 +359,7 @@ func (w *Wallet) syncWithChain(birthdayStamp *waddrmgr.BlockStamp) error {
// arbitrary height, rather than all the blocks from genesis, so
// we persist this height to ensure we don't store any blocks
// before it.
_, bestHeight, err := chainClient.GetBestBlock()
if err != nil {
return err
}
startHeight := bestHeight - waddrmgr.MaxReorgDepth + 1
if startHeight < 0 {
startHeight = 0
}
if birthdayStamp.Height < startHeight {
startHeight = birthdayStamp.Height
}
startHeight := birthdayStamp.Height
// With the starting height obtained, get the remaining block
// details required by the wallet.