channeldb: fix linter errors

This commit is contained in:
Olaoluwa Osuntokun 2018-01-30 20:40:41 -08:00
parent b54b8dd7f1
commit e578cea375
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

View File

@ -1020,17 +1020,17 @@ type LightningNode struct {
// //
// NOTE: By having this method to access an attribute, we ensure we only need // NOTE: By having this method to access an attribute, we ensure we only need
// to fully deserialize the pubkey if absolutely necessary. // to fully deserialize the pubkey if absolutely necessary.
func (c *LightningNode) PubKey() (*btcec.PublicKey, error) { func (l *LightningNode) PubKey() (*btcec.PublicKey, error) {
if c.pubKey != nil { if l.pubKey != nil {
return c.pubKey, nil return l.pubKey, nil
} }
key, err := btcec.ParsePubKey(c.PubKeyBytes[:], btcec.S256()) key, err := btcec.ParsePubKey(l.PubKeyBytes[:], btcec.S256())
if err != nil { if err != nil {
return nil, err return nil, err
} }
c.pubKey = key l.pubKey = key
c.pubKey.Curve = nil l.pubKey.Curve = nil
return key, nil return key, nil
} }
@ -1040,15 +1040,15 @@ func (c *LightningNode) PubKey() (*btcec.PublicKey, error) {
// //
// NOTE: By having this method to access an attribute, we ensure we only need // NOTE: By having this method to access an attribute, we ensure we only need
// to fully deserialize the signature if absolutely necessary. // to fully deserialize the signature if absolutely necessary.
func (c *LightningNode) AuthSig() (*btcec.Signature, error) { func (l *LightningNode) AuthSig() (*btcec.Signature, error) {
return btcec.ParseSignature(c.AuthSigBytes, btcec.S256()) return btcec.ParseSignature(l.AuthSigBytes, btcec.S256())
} }
// AddPubKey is a setter-link method that can be used to swap out the public // AddPubKey is a setter-link method that can be used to swap out the public
// key for a node. // key for a node.
func (c *LightningNode) AddPubKey(key *btcec.PublicKey) { func (l *LightningNode) AddPubKey(key *btcec.PublicKey) {
c.pubKey = key l.pubKey = key
copy(c.PubKeyBytes[:], key.SerializeCompressed()) copy(l.PubKeyBytes[:], key.SerializeCompressed())
} }
// FetchLightningNode attempts to look up a target node by its identity public // FetchLightningNode attempts to look up a target node by its identity public
@ -1442,7 +1442,7 @@ type ChannelAuthProof struct {
BitcoinSig2Bytes []byte BitcoinSig2Bytes []byte
} }
// NodeSig1 is the signature using the identity key of the node that is first // Node1Sig is the signature using the identity key of the node that is first
// in a lexicographical ordering of the serialized public keys of the two nodes // in a lexicographical ordering of the serialized public keys of the two nodes
// that created the channel. // that created the channel.
// //
@ -1463,7 +1463,7 @@ func (c *ChannelAuthProof) Node1Sig() (*btcec.Signature, error) {
return sig, nil return sig, nil
} }
// NodeSig2 is the signature using the identity key of the node that is second // Node2Sig is the signature using the identity key of the node that is second
// in a lexicographical ordering of the serialized public keys of the two nodes // in a lexicographical ordering of the serialized public keys of the two nodes
// that created the channel. // that created the channel.
// //
@ -1526,11 +1526,11 @@ func (c *ChannelAuthProof) BitcoinSig2() (*btcec.Signature, error) {
// IsEmpty check is the authentication proof is empty Proof is empty if at // IsEmpty check is the authentication proof is empty Proof is empty if at
// least one of the signatures are equal to nil. // least one of the signatures are equal to nil.
func (p *ChannelAuthProof) IsEmpty() bool { func (c *ChannelAuthProof) IsEmpty() bool {
return len(p.NodeSig1Bytes) == 0 || return len(c.NodeSig1Bytes) == 0 ||
len(p.NodeSig2Bytes) == 0 || len(c.NodeSig2Bytes) == 0 ||
len(p.BitcoinSig1Bytes) == 0 || len(c.BitcoinSig1Bytes) == 0 ||
len(p.BitcoinSig2Bytes) == 0 len(c.BitcoinSig2Bytes) == 0
} }
// ChannelEdgePolicy represents a *directed* edge within the channel graph. For // ChannelEdgePolicy represents a *directed* edge within the channel graph. For