• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lightningnetwork / lnd / 13035292482

29 Jan 2025 03:59PM UTC coverage: 49.3% (-9.5%) from 58.777%
13035292482

Pull #9456

github

mohamedawnallah
docs: update release-notes-0.19.0.md

In this commit, we warn users about the removal
of RPCs `SendToRoute`, `SendToRouteSync`, `SendPayment`,
and `SendPaymentSync` in the next release 0.20.
Pull Request #9456: lnrpc+docs: deprecate warning `SendToRoute`, `SendToRouteSync`, `SendPayment`, and `SendPaymentSync` in Release 0.19

100634 of 204126 relevant lines covered (49.3%)

1.54 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/watchtower/wtdb/migration4/codec.go
1
package migration4
2

3
import (
4
        "encoding/binary"
5
        "encoding/hex"
6
        "fmt"
7
        "io"
8
)
9

10
// SessionIDSize is 33-bytes; it is a serialized, compressed public key.
11
const SessionIDSize = 33
12

13
// SessionID is created from the remote public key of a client, and serves as a
14
// unique identifier and authentication for sending state updates.
15
type SessionID [SessionIDSize]byte
16

17
// String returns a hex encoding of the session id.
18
func (s SessionID) String() string {
×
19
        return hex.EncodeToString(s[:])
×
20
}
×
21

22
// ChannelID is a series of 32-bytes that uniquely identifies all channels
23
// within the network. The ChannelID is computed using the outpoint of the
24
// funding transaction (the txid, and output index). Given a funding output the
25
// ChannelID can be calculated by XOR'ing the big-endian serialization of the
26
// txid and the big-endian serialization of the output index, truncated to
27
// 2 bytes.
28
type ChannelID [32]byte
29

30
// String returns the string representation of the ChannelID. This is just the
31
// hex string encoding of the ChannelID itself.
32
func (c ChannelID) String() string {
×
33
        return hex.EncodeToString(c[:])
×
34
}
×
35

36
// BackupID identifies a particular revoked, remote commitment by channel id and
37
// commitment height.
38
type BackupID struct {
39
        // ChanID is the channel id of the revoked commitment.
40
        ChanID ChannelID
41

42
        // CommitHeight is the commitment height of the revoked commitment.
43
        CommitHeight uint64
44
}
45

46
// Encode writes the BackupID from the passed io.Writer.
47
func (b *BackupID) Encode(w io.Writer) error {
×
48
        return WriteElements(w,
×
49
                b.ChanID,
×
50
                b.CommitHeight,
×
51
        )
×
52
}
×
53

54
// Decode reads a BackupID from the passed io.Reader.
55
func (b *BackupID) Decode(r io.Reader) error {
×
56
        return ReadElements(r,
×
57
                &b.ChanID,
×
58
                &b.CommitHeight,
×
59
        )
×
60
}
×
61

62
// String returns a human-readable encoding of a BackupID.
63
func (b BackupID) String() string {
×
64
        return fmt.Sprintf("backup(%v, %d)", b.ChanID, b.CommitHeight)
×
65
}
×
66

67
// WriteElements serializes a variadic list of elements into the given
68
// io.Writer.
69
func WriteElements(w io.Writer, elements ...interface{}) error {
×
70
        for _, element := range elements {
×
71
                if err := WriteElement(w, element); err != nil {
×
72
                        return err
×
73
                }
×
74
        }
75

76
        return nil
×
77
}
78

79
// ReadElements deserializes the provided io.Reader into a variadic list of
80
// target elements.
81
func ReadElements(r io.Reader, elements ...interface{}) error {
×
82
        for _, element := range elements {
×
83
                if err := ReadElement(r, element); err != nil {
×
84
                        return err
×
85
                }
×
86
        }
87

88
        return nil
×
89
}
90

91
// WriteElement serializes a single element into the provided io.Writer.
92
func WriteElement(w io.Writer, element interface{}) error {
×
93
        switch e := element.(type) {
×
94
        case ChannelID:
×
95
                if _, err := w.Write(e[:]); err != nil {
×
96
                        return err
×
97
                }
×
98

99
        case uint64:
×
100
                if err := binary.Write(w, byteOrder, e); err != nil {
×
101
                        return err
×
102
                }
×
103

104
        default:
×
105
                return fmt.Errorf("unexpected type")
×
106
        }
107

108
        return nil
×
109
}
110

111
// ReadElement deserializes a single element from the provided io.Reader.
112
func ReadElement(r io.Reader, element interface{}) error {
×
113
        switch e := element.(type) {
×
114
        case *ChannelID:
×
115
                if _, err := io.ReadFull(r, e[:]); err != nil {
×
116
                        return err
×
117
                }
×
118

119
        case *uint64:
×
120
                if err := binary.Read(r, byteOrder, e); err != nil {
×
121
                        return err
×
122
                }
×
123

124
        default:
×
125
                return fmt.Errorf("unexpected type")
×
126
        }
127

128
        return nil
×
129
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc