channeldb: add new MarkAsOpen method to OpenChannel struct

In this commit we add a new MarkAsOpen method to the OpenChannel
struct. This method replaces the existing MarkChannelAsOpen method
which targeted the database struct itself.
This commit is contained in:
Olaoluwa Osuntokun
2017-11-09 20:24:12 -08:00
parent 4ae0b008ed
commit 2dcd82e779
2 changed files with 12 additions and 46 deletions

View File

@@ -487,6 +487,18 @@ func (c *OpenChannel) fullSync(tx *bolt.Tx) error {
return putOpenChannel(chanBucket, c)
}
// MarkAsOpen marks a channel as fully open given a locator that uniquely
// describes its location within the chain.
func (c *OpenChannel) MarkAsOpen(openLoc lnwire.ShortChannelID) error {
return c.Db.Update(func(tx *bolt.Tx) error {
chanBucket, err := updateChanBucket(tx, c.IdentityPub,
&c.FundingOutpoint, c.ChainHash)
if err != nil {
return err
}
channel, err := fetchOpenChannel(chanBucket, &c.FundingOutpoint)
if err != nil {
return err
}