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 // FetchChannel attempts to locate a channel specified by the passed channel
// point. If the channel cannot be found, then an error will be returned. // 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 // Optionally an existing db tx can be supplied.
// can be supplied.
func (c *ChannelStateDB) FetchChannel(tx kvdb.RTx, chanPoint wire.OutPoint) ( func (c *ChannelStateDB) FetchChannel(tx kvdb.RTx, chanPoint wire.OutPoint) (
*OpenChannel, error) { *OpenChannel, error) {
@@ -694,7 +693,9 @@ func (c *ChannelStateDB) FetchChannel(tx kvdb.RTx, chanPoint wire.OutPoint) (
return nil return nil
} }
nodeChanBucket := openChanBucket.NestedReadBucket(nodePub) nodeChanBucket := openChanBucket.NestedReadBucket(
nodePub,
)
if nodeChanBucket == nil { if nodeChanBucket == nil {
return nil return nil
} }
@@ -715,10 +716,11 @@ func (c *ChannelStateDB) FetchChannel(tx kvdb.RTx, chanPoint wire.OutPoint) (
) )
if chainBucket == nil { if chainBucket == nil {
return fmt.Errorf("unable to read "+ 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. // all the chanPoints for this node.
chanBucket := chainBucket.NestedReadBucket( chanBucket := chainBucket.NestedReadBucket(
targetChanPoint.Bytes(), targetChanPoint.Bytes(),