channeldb: ensure channel buckets are only created once

In this commit, we ensure that we only create the sub-bucket for
channels once: at the time of creation. We do this as otherwise it's
possible that a method that mutates a channel's state is called after it
has already been closed on-chain, leading to the channel bucket being
recreated.
This commit is contained in:
Wilmer Paulino
2018-09-21 17:03:56 -07:00
parent f4305097e1
commit f13c1d2787
2 changed files with 47 additions and 83 deletions

View File

@@ -43,6 +43,10 @@ var (
// specific identity can't be found.
ErrNodeNotFound = fmt.Errorf("link node with target identity not found")
// ErrChannelNotFound is returned when we attempt to locate a channel
// for a specific chain, but it is not found.
ErrChannelNotFound = fmt.Errorf("channel not found")
// ErrMetaNotFound is returned when meta bucket hasn't been
// created.
ErrMetaNotFound = fmt.Errorf("unable to locate meta information")