wallet: only log block batch if non-empty

This fixes an issue reputed by a user that would cause btcwallet to
panic if the full node was stopped while btcwallet was still restoring
the wallet.
This commit is contained in:
Olaoluwa Osuntokun 2019-02-27 18:38:17 -03:00
parent b51c1adeee
commit b9da1fbd8d
No known key found for this signature in database
GPG key ID: CE58F7F8E20FD9A2

View file

@ -732,8 +732,10 @@ func (w *Wallet) recovery(startHeight int32) error {
return err
}
log.Infof("Recovered addresses from blocks %d-%d", blockBatch[0].Height,
blockBatch[len(blockBatch)-1].Height)
if len(blockBatch) > 0 {
log.Infof("Recovered addresses from blocks %d-%d", blockBatch[0].Height,
blockBatch[len(blockBatch)-1].Height)
}
return nil
}