multi: formatting changes

This commit is contained in:
naveen 2021-12-13 15:32:22 +01:00 committed by Oliver Gugger
parent 0f167fd03e
commit 545e84f4ce
No known key found for this signature in database
GPG key ID: 8E4256593F177720
6 changed files with 9 additions and 19 deletions

View file

@ -1891,7 +1891,7 @@ func (k *CircuitKey) SetBytes(bs []byte) error {
// Bytes returns the serialized bytes for this circuit key. // Bytes returns the serialized bytes for this circuit key.
func (k CircuitKey) Bytes() []byte { func (k CircuitKey) Bytes() []byte {
var bs = make([]byte, 16) bs := make([]byte, 16)
binary.BigEndian.PutUint64(bs[:8], k.ChanID.ToUint64()) binary.BigEndian.PutUint64(bs[:8], k.ChanID.ToUint64())
binary.BigEndian.PutUint64(bs[8:], k.HtlcID) binary.BigEndian.PutUint64(bs[8:], k.HtlcID)
return bs return bs
@ -3468,7 +3468,6 @@ func putChanCommitments(chanBucket kvdb.RwBucket, channel *OpenChannel) error {
} }
func putChanRevocationState(chanBucket kvdb.RwBucket, channel *OpenChannel) error { func putChanRevocationState(chanBucket kvdb.RwBucket, channel *OpenChannel) error {
var b bytes.Buffer var b bytes.Buffer
err := WriteElements( err := WriteElements(
&b, channel.RemoteCurrentRevocation, channel.RevocationProducer, &b, channel.RemoteCurrentRevocation, channel.RevocationProducer,
@ -3659,7 +3658,6 @@ func fetchChanRevocationState(chanBucket kvdb.RBucket, channel *OpenChannel) err
} }
func deleteOpenChannel(chanBucket kvdb.RwBucket) error { func deleteOpenChannel(chanBucket kvdb.RwBucket) error {
if err := chanBucket.Delete(chanInfoKey); err != nil { if err := chanBucket.Delete(chanInfoKey); err != nil {
return err return err
} }
@ -3682,7 +3680,6 @@ func deleteOpenChannel(chanBucket kvdb.RwBucket) error {
} }
return nil return nil
} }
// makeLogKey converts a uint64 into an 8 byte array. // makeLogKey converts a uint64 into an 8 byte array.

View file

@ -862,7 +862,6 @@ func (c *ChannelGraph) deleteLightningNode(nodes kvdb.RwBucket,
} }
if err := nodes.Delete(compressedPubKey); err != nil { if err := nodes.Delete(compressedPubKey); err != nil {
return err return err
} }
@ -980,7 +979,6 @@ func (c *ChannelGraph) addChannelEdge(tx kvdb.RwTx, edge *ChannelEdgeInfo) error
if err != nil { if err != nil {
return fmt.Errorf("unable to create shell node "+ return fmt.Errorf("unable to create shell node "+
"for: %x", edge.NodeKey1Bytes) "for: %x", edge.NodeKey1Bytes)
} }
case node1Err != nil: case node1Err != nil:
return err return err
@ -997,7 +995,6 @@ func (c *ChannelGraph) addChannelEdge(tx kvdb.RwTx, edge *ChannelEdgeInfo) error
if err != nil { if err != nil {
return fmt.Errorf("unable to create shell node "+ return fmt.Errorf("unable to create shell node "+
"for: %x", edge.NodeKey2Bytes) "for: %x", edge.NodeKey2Bytes)
} }
case node2Err != nil: case node2Err != nil:
return err return err
@ -1012,11 +1009,12 @@ func (c *ChannelGraph) addChannelEdge(tx kvdb.RwTx, edge *ChannelEdgeInfo) error
// Mark edge policies for both sides as unknown. This is to enable // Mark edge policies for both sides as unknown. This is to enable
// efficient incoming channel lookup for a node. // efficient incoming channel lookup for a node.
for _, key := range []*[33]byte{&edge.NodeKey1Bytes, keys := []*[33]byte{
&edge.NodeKey2Bytes} { &edge.NodeKey1Bytes,
&edge.NodeKey2Bytes,
err := putChanEdgePolicyUnknown(edges, edge.ChannelID, }
key[:]) for _, key := range keys {
err := putChanEdgePolicyUnknown(edges, edge.ChannelID, key[:])
if err != nil { if err != nil {
return err return err
} }
@ -2468,7 +2466,6 @@ func updateEdgePolicy(tx kvdb.RwTx, edge *ChannelEdgePolicy,
edges := tx.ReadWriteBucket(edgeBucket) edges := tx.ReadWriteBucket(edgeBucket)
if edges == nil { if edges == nil {
return false, ErrEdgeNotFound return false, ErrEdgeNotFound
} }
edgeIndex := edges.NestedReadWriteBucket(edgeIndexBucket) edgeIndex := edges.NestedReadWriteBucket(edgeIndexBucket)
if edgeIndex == nil { if edgeIndex == nil {
@ -3125,7 +3122,8 @@ func (c *ChannelEdgeInfo) OtherNodeKeyBytes(thisNodeKey []byte) (
// the target node in the channel. This is useful when one knows the pubkey of // the target node in the channel. This is useful when one knows the pubkey of
// one of the nodes, and wishes to obtain the full LightningNode for the other // one of the nodes, and wishes to obtain the full LightningNode for the other
// end of the channel. // end of the channel.
func (c *ChannelEdgeInfo) FetchOtherNode(tx kvdb.RTx, thisNodeKey []byte) (*LightningNode, error) { func (c *ChannelEdgeInfo) FetchOtherNode(tx kvdb.RTx,
thisNodeKey []byte) (*LightningNode, error) {
// Ensure that the node passed in is actually a member of the channel. // Ensure that the node passed in is actually a member of the channel.
var targetNodeBytes [33]byte var targetNodeBytes [33]byte

View file

@ -315,7 +315,6 @@ func fetchPayment(bucket kvdb.RBucket) (*MPPayment, error) {
creationInfo, err := fetchCreationInfo(bucket) creationInfo, err := fetchCreationInfo(bucket)
if err != nil { if err != nil {
return nil, err return nil, err
} }
var htlcs []HTLCAttempt var htlcs []HTLCAttempt

View file

@ -285,7 +285,6 @@ func extraArgsEtcd(etcdCfg *etcd.Config, name string, cluster bool) []string {
if etcdCfg.InsecureSkipVerify { if etcdCfg.InsecureSkipVerify {
extraArgs = append(extraArgs, "--db.etcd.insecure_skip_verify") extraArgs = append(extraArgs, "--db.etcd.insecure_skip_verify")
} }
if cluster { if cluster {
@ -619,7 +618,6 @@ func (n *NetworkHarness) EnsureConnected(t *testing.T, a, b *HarnessNode) {
predErr = err predErr = err
return false return false
} }
}, DefaultTimeout) }, DefaultTimeout)
if err != nil { if err != nil {
return fmt.Errorf("connection not succeeded within 15 "+ return fmt.Errorf("connection not succeeded within 15 "+

View file

@ -570,7 +570,6 @@ func assertNotConnected(t *harnessTest, alice, bob *lntest.HarnessNode) {
} }
return nil return nil
}, defaultTimeout) }, defaultTimeout)
require.NoError(t.t, err) require.NoError(t.t, err)
} }

View file

@ -122,7 +122,6 @@ func WritePublicKey(buf *bytes.Buffer, pub *btcec.PublicKey) error {
serializedPubkey := pub.SerializeCompressed() serializedPubkey := pub.SerializeCompressed()
return WriteBytes(buf, serializedPubkey) return WriteBytes(buf, serializedPubkey)
} }
// WriteChannelID appends the ChannelID to the provided buffer. // WriteChannelID appends the ChannelID to the provided buffer.