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

lightningnetwork / lnd / 13211764208

08 Feb 2025 03:08AM UTC coverage: 49.288% (-9.5%) from 58.815%
13211764208

Pull #9489

github

calvinrzachman
itest: verify switchrpc server enforces send then track

We prevent the rpc server from allowing onion dispatches for
attempt IDs which have already been tracked by rpc clients.

This helps protect the client from leaking a duplicate onion
attempt. NOTE: This is not the only method for solving this
issue! The issue could be addressed via careful client side
programming which accounts for the uncertainty and async
nature of dispatching onions to a remote process via RPC.
This would require some lnd ChannelRouter changes for how
we intend to use these RPCs though.
Pull Request #9489: multi: add BuildOnion, SendOnion, and TrackOnion RPCs

474 of 990 new or added lines in 11 files covered. (47.88%)

27321 existing lines in 435 files now uncovered.

101192 of 205306 relevant lines covered (49.29%)

1.54 hits per line

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

0.0
/channeldb/migration_01_to_11/legacy_serialization.go
1
package migration_01_to_11
2

3
import (
4
        "io"
5
)
6

7
// deserializeCloseChannelSummaryV6 reads the v6 database format for
8
// ChannelCloseSummary.
9
//
10
// NOTE: deprecated, only for migration.
UNCOV
11
func deserializeCloseChannelSummaryV6(r io.Reader) (*ChannelCloseSummary, error) {
×
UNCOV
12
        c := &ChannelCloseSummary{}
×
UNCOV
13

×
UNCOV
14
        err := ReadElements(r,
×
UNCOV
15
                &c.ChanPoint, &c.ShortChanID, &c.ChainHash, &c.ClosingTXID,
×
UNCOV
16
                &c.CloseHeight, &c.RemotePub, &c.Capacity, &c.SettledBalance,
×
UNCOV
17
                &c.TimeLockedBalance, &c.CloseType, &c.IsPending,
×
UNCOV
18
        )
×
UNCOV
19
        if err != nil {
×
20
                return nil, err
×
21
        }
×
22

23
        // We'll now check to see if the channel close summary was encoded with
24
        // any of the additional optional fields.
UNCOV
25
        err = ReadElements(r, &c.RemoteCurrentRevocation)
×
UNCOV
26
        switch {
×
UNCOV
27
        case err == io.EOF:
×
UNCOV
28
                return c, nil
×
29

30
        // If we got a non-eof error, then we know there's an actually issue.
31
        // Otherwise, it may have been the case that this summary didn't have
32
        // the set of optional fields.
33
        case err != nil:
×
34
                return nil, err
×
35
        }
36

UNCOV
37
        if err := ReadChanConfig(r, &c.LocalChanConfig); err != nil {
×
38
                return nil, err
×
39
        }
×
40

41
        // Finally, we'll attempt to read the next unrevoked commitment point
42
        // for the remote party. If we closed the channel before receiving a
43
        // funding locked message, then this can be nil. As a result, we'll use
44
        // the same technique to read the field, only if there's still data
45
        // left in the buffer.
UNCOV
46
        err = ReadElements(r, &c.RemoteNextRevocation)
×
UNCOV
47
        if err != nil && err != io.EOF {
×
48
                // If we got a non-eof error, then we know there's an actually
×
49
                // issue. Otherwise, it may have been the case that this
×
50
                // summary didn't have the set of optional fields.
×
51
                return nil, err
×
52
        }
×
53

UNCOV
54
        return c, nil
×
55
}
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