• 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
/watchtower/wtwire/error.go
1
package wtwire
2

3
import "io"
4

5
// Error is a generic error message that can be sent to a client if a request
6
// fails outside of prescribed protocol errors. Typically this would be followed
7
// by the server disconnecting the client, and so can be useful to transferring
8
// the exact reason.
9
type Error struct {
10
        // Code specifies the error code encountered by the server.
11
        Code ErrorCode
12

13
        // Data encodes a payload whose contents can be interpreted by the
14
        // client in response to the error code.
15
        Data []byte
16
}
17

18
// NewError returns an freshly-initialized Error message.
19
func NewError() *Error {
×
20
        return &Error{}
×
21
}
×
22

23
// A compile time check to ensure Error implements the wtwire.Message interface.
24
var _ Message = (*Error)(nil)
25

26
// Decode deserializes a serialized Error message stored in the passed io.Reader
27
// observing the specified protocol version.
28
//
29
// This is part of the wtwire.Message interface.
UNCOV
30
func (e *Error) Decode(r io.Reader, pver uint32) error {
×
UNCOV
31
        return ReadElements(r,
×
UNCOV
32
                &e.Code,
×
UNCOV
33
                &e.Data,
×
UNCOV
34
        )
×
UNCOV
35
}
×
36

37
// Encode serializes the target Error into the passed io.Writer observing the
38
// protocol version specified.
39
//
40
// This is part of the wtwire.Message interface.
UNCOV
41
func (e *Error) Encode(w io.Writer, prver uint32) error {
×
UNCOV
42
        return WriteElements(w,
×
UNCOV
43
                e.Code,
×
UNCOV
44
                e.Data,
×
UNCOV
45
        )
×
UNCOV
46
}
×
47

48
// MsgType returns the integer uniquely identifying this message type on the
49
// wire.
50
//
51
// This is part of the wtwire.Message interface.
UNCOV
52
func (e *Error) MsgType() MessageType {
×
UNCOV
53
        return MsgError
×
UNCOV
54
}
×
55

56
// MaxPayloadLength returns the maximum allowed payload size for a Error
57
// complete message observing the specified protocol version.
58
//
59
// This is part of the wtwire.Message interface.
UNCOV
60
func (e *Error) MaxPayloadLength(uint32) uint32 {
×
UNCOV
61
        return MaxMessagePayload
×
UNCOV
62
}
×
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