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

lightningnetwork / lnd / 17771623214

16 Sep 2025 03:55PM UTC coverage: 57.218% (-9.4%) from 66.645%
17771623214

Pull #9489

github

web-flow
Merge 7d73e5cff into 9a6d34a02
Pull Request #9489: multi: add BuildOnion, SendOnion, and TrackOnion RPCs

329 of 564 new or added lines in 12 files covered. (58.33%)

28538 existing lines in 459 files now uncovered.

99745 of 174325 relevant lines covered (57.22%)

1.78 hits per line

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

0.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,
NEW
23
        attemptID uint64, htlc *lnwire.UpdateAddHTLC) error {
×
NEW
24

×
NEW
25
        return m.sendErr
×
NEW
26
}
×
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) (
NEW
32
        <-chan *htlcswitch.PaymentResult, error) {
×
NEW
33

×
NEW
34
        if m.getResultErr != nil {
×
NEW
35
                return nil, m.getResultErr
×
NEW
36
        }
×
37

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

NEW
43
        return resultChan, nil
×
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) (
NEW
65
        *route.Route, error) {
×
NEW
66

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