channeldb: check for tombstone before opening DB
To avoid running a channel DB that was successfully migrated to another system by accident, we check if there is a tombstone marker before we open the DB for use.
This commit is contained in:
2 files changed
+10
No files matched your search
@@ -436,6 +436,11 @@ func (d *DB) Wipe() error {
|
||||
// the database are created.
|
||||
func initChannelDB(db kvdb.Backend) error {
|
||||
err := kvdb.Update(db, func(tx kvdb.RwTx) error {
|
||||
// Check if DB was marked as inactive with a tomb stone.
|
||||
if err := EnsureNoTombstone(tx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
meta := &Meta{}
|
||||
// Check if DB is already initialized.
|
||||
err := FetchMeta(meta, tx)
|
||||
|
||||
Reference in new issue
Block a user