channeldb: properly handle ErrMetaNotFound error within syncVersions

This commit is contained in:
Olaoluwa Osuntokun 2016-11-27 18:36:17 -08:00
parent 8312ce587a
commit 1e710b73a0
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -307,8 +307,12 @@ func (d *DB) FetchAllChannels() ([]*OpenChannel, error) {
func (d *DB) syncVersions(versions []version) error {
meta, err := d.FetchMeta(nil)
if err != nil {
if err == ErrMetaNotFound {
meta = &Meta{}
} else {
return err
}
}
// If the current database version matches the latest version number,
// then we don't need to perform any migrations.