channeldb: lint FetchChannel method

A few lint fixes of the FetchChannel method.
This commit is contained in:
Elle Mouton
2023-02-02 10:56:15 +02:00
parent cab0560d5e
commit aebdd2375c

View File

@@ -654,8 +654,7 @@ func (c *ChannelStateDB) fetchNodeChannels(chainBucket kvdb.RBucket) (
// FetchChannel attempts to locate a channel specified by the passed channel
// point. If the channel cannot be found, then an error will be returned.
// Optionally an existing db tx can be supplied. Optionally an existing db tx
// can be supplied.
// Optionally an existing db tx can be supplied.
func (c *ChannelStateDB) FetchChannel(tx kvdb.RTx, chanPoint wire.OutPoint) (
*OpenChannel, error) {
@@ -694,7 +693,9 @@ func (c *ChannelStateDB) FetchChannel(tx kvdb.RTx, chanPoint wire.OutPoint) (
return nil
}
nodeChanBucket := openChanBucket.NestedReadBucket(nodePub)
nodeChanBucket := openChanBucket.NestedReadBucket(
nodePub,
)
if nodeChanBucket == nil {
return nil
}
@@ -715,10 +716,11 @@ func (c *ChannelStateDB) FetchChannel(tx kvdb.RTx, chanPoint wire.OutPoint) (
)
if chainBucket == nil {
return fmt.Errorf("unable to read "+
"bucket for chain=%x", chainHash[:])
"bucket for chain=%x",
chainHash)
}
// Finally we reach the leaf bucket that stores
// Finally, we reach the leaf bucket that stores
// all the chanPoints for this node.
chanBucket := chainBucket.NestedReadBucket(
targetChanPoint.Bytes(),
@@ -757,7 +759,7 @@ func (c *ChannelStateDB) FetchChannel(tx kvdb.RTx, chanPoint wire.OutPoint) (
}
// If we can't find the channel, then we return with an error, as we
// have nothing to backup.
// have nothing to back up.
return nil, ErrChannelNotFound
}