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

lightningnetwork / lnd / 17871584347

19 Sep 2025 10:57PM UTC coverage: 66.151% (-0.5%) from 66.637%
17871584347

Pull #9489

github

web-flow
Merge 477dc5159 into b34fc964b
Pull Request #9489: multi: add BuildOnion, SendOnion, and TrackOnion RPCs

460 of 616 new or added lines in 14 files covered. (74.68%)

52 existing lines in 18 files now uncovered.

136779 of 206767 relevant lines covered (66.15%)

21206.67 hits per line

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

75.0
/lnrpc/switchrpc/mock.go
1
//go:build switchrpc
2
// +build switchrpc
3

4
package switchrpc
5

6
import (
7
        "github.com/lightningnetwork/lnd/htlcswitch"
8
        "github.com/lightningnetwork/lnd/lnrpc"
9
        "github.com/lightningnetwork/lnd/lntypes"
10
        "github.com/lightningnetwork/lnd/lnwire"
11
        "github.com/lightningnetwork/lnd/routing/route"
12
)
13

14
// mockPayer is a mock implementation of the htlcswitch.Payer interface.
15
type mockPayer struct {
16
        sendErr         error
17
        getResultResult *htlcswitch.PaymentResult
18
        getResultErr    error
19
}
20

21
// SendHTLC is a mock implementation of the SendHTLC method.
22
func (m *mockPayer) SendHTLC(firstHop lnwire.ShortChannelID,
23
        attemptID uint64, htlc *lnwire.UpdateAddHTLC) error {
3✔
24

3✔
25
        return m.sendErr
3✔
26
}
3✔
27

28
// GetAttemptResult is a mock implementation of the GetAttemptResult method.
29
func (m *mockPayer) GetAttemptResult(attemptID uint64,
30
        paymentHash lntypes.Hash,
31
        errorDecryptor htlcswitch.ErrorDecrypter) (
32
        <-chan *htlcswitch.PaymentResult, error) {
5✔
33

5✔
34
        if m.getResultErr != nil {
6✔
35
                return nil, m.getResultErr
1✔
36
        }
1✔
37

38
        resultChan := make(chan *htlcswitch.PaymentResult, 1)
4✔
39
        if m.getResultResult != nil {
7✔
40
                resultChan <- m.getResultResult
3✔
41
        }
3✔
42

43
        return resultChan, nil
4✔
44
}
45

46
// GetAttemptResult is a mock implementation of the GetAttemptResult method.
NEW
47
func (m *mockPayer) HasAttemptResult(attemptID uint64) (bool, error) {
×
NEW
48
        return true, nil
×
NEW
49
}
×
50

51
// CleanStore is a mock implementation of the CleanStore method.
NEW
52
func (m *mockPayer) CleanStore(keepPids map[uint64]struct{}) error {
×
NEW
53
        return nil
×
NEW
54
}
×
55

56
// mockRouteProcessor is a mock implementation of the routing.RouteProcessor
57
// interface.
58
type mockRouteProcessor struct {
59
        unmarshallErr   error
60
        unmarshallRoute *route.Route
61
}
62

63
// UnmarshallRoute is a mock implementation of the UnmarshallRoute method.
64
func (m *mockRouteProcessor) UnmarshallRoute(route *lnrpc.Route) (
65
        *route.Route, error) {
3✔
66

3✔
67
        return m.unmarshallRoute, m.unmarshallErr
3✔
68
}
3✔
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