From b9da1fbd8db4acee733562d23f3f3905eed1789b Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 27 Feb 2019 18:38:17 -0300 Subject: [PATCH] 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. --- wallet/wallet.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wallet/wallet.go b/wallet/wallet.go index b823d90..5341621 100644 --- a/wallet/wallet.go +++ b/wallet/wallet.go @@ -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 }