channeldb: return nil for error if openChanBucket not created

This avoids an unnecessary panic in the case that the channeldb has
been wiped independently while a new peer connects.
This commit is contained in:
Olaoluwa Osuntokun 2016-07-09 16:19:18 -07:00
parent 40d9f0da31
commit 4590364d04
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -150,8 +150,8 @@ func (d *DB) FetchOpenChannels(nodeID *wire.ShaHash) ([]*OpenChannel, error) {
// Get the bucket dedicated to storing the meta-data for open
// channels.
openChanBucket := tx.Bucket(openChannelBucket)
if openChannelBucket == nil {
return fmt.Errorf("open channel bucket does not exist")
if openChanBucket == nil {
return nil
}
// Within this top level bucket, fetch the bucket dedicated to storing