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

lightningnetwork / lnd / 11216766535

07 Oct 2024 01:37PM UTC coverage: 57.817% (-1.0%) from 58.817%
11216766535

Pull #9148

github

ProofOfKeags
lnwire: remove kickoff feerate from propose/commit
Pull Request #9148: DynComms [2/n]: lnwire: add authenticated wire messages for Dyn*

571 of 879 new or added lines in 16 files covered. (64.96%)

23253 existing lines in 251 files now uncovered.

99022 of 171268 relevant lines covered (57.82%)

38420.67 hits per line

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

0.0
/lntest/rpc/harness_rpc.go
1
package rpc
2

3
import (
4
        "context"
5
        "testing"
6

7
        "github.com/btcsuite/btcd/wire"
8
        "github.com/lightningnetwork/lnd/lnrpc"
9
        "github.com/lightningnetwork/lnd/lnrpc/chainrpc"
10
        "github.com/lightningnetwork/lnd/lnrpc/devrpc"
11
        "github.com/lightningnetwork/lnd/lnrpc/invoicesrpc"
12
        "github.com/lightningnetwork/lnd/lnrpc/neutrinorpc"
13
        "github.com/lightningnetwork/lnd/lnrpc/peersrpc"
14
        "github.com/lightningnetwork/lnd/lnrpc/routerrpc"
15
        "github.com/lightningnetwork/lnd/lnrpc/signrpc"
16
        "github.com/lightningnetwork/lnd/lnrpc/walletrpc"
17
        "github.com/lightningnetwork/lnd/lnrpc/watchtowerrpc"
18
        "github.com/lightningnetwork/lnd/lnrpc/wtclientrpc"
19
        "github.com/lightningnetwork/lnd/lntest/wait"
20
        "github.com/stretchr/testify/require"
21
        "google.golang.org/grpc"
22
)
23

24
const (
25
        DefaultTimeout = wait.DefaultTimeout
26
)
27

28
// HarnessRPC wraps all lnd's RPC clients into a single struct for easier
29
// access.
30
type HarnessRPC struct {
31
        *testing.T
32

33
        LN               lnrpc.LightningClient
34
        WalletUnlocker   lnrpc.WalletUnlockerClient
35
        Invoice          invoicesrpc.InvoicesClient
36
        Signer           signrpc.SignerClient
37
        Router           routerrpc.RouterClient
38
        WalletKit        walletrpc.WalletKitClient
39
        Watchtower       watchtowerrpc.WatchtowerClient
40
        WatchtowerClient wtclientrpc.WatchtowerClientClient
41
        State            lnrpc.StateClient
42
        ChainClient      chainrpc.ChainNotifierClient
43
        ChainKit         chainrpc.ChainKitClient
44
        NeutrinoKit      neutrinorpc.NeutrinoKitClient
45
        Peer             peersrpc.PeersClient
46
        Dev              devrpc.DevClient
47

48
        // Name is the HarnessNode's name.
49
        Name string
50

51
        // runCtx is a context with cancel method. It's used to signal when the
52
        // node needs to quit, and used as the parent context when spawning
53
        // children contexts for RPC requests.
54
        runCtx context.Context //nolint:containedctx
55
        cancel context.CancelFunc
56
}
57

58
// NewHarnessRPC creates a new HarnessRPC with its own context inherted from
59
// the pass context.
60
func NewHarnessRPC(ctxt context.Context, t *testing.T, c *grpc.ClientConn,
61
        name string) *HarnessRPC {
×
62

×
63
        h := &HarnessRPC{
×
64
                T:                t,
×
65
                LN:               lnrpc.NewLightningClient(c),
×
66
                Invoice:          invoicesrpc.NewInvoicesClient(c),
×
67
                Router:           routerrpc.NewRouterClient(c),
×
68
                WalletKit:        walletrpc.NewWalletKitClient(c),
×
69
                WalletUnlocker:   lnrpc.NewWalletUnlockerClient(c),
×
70
                Watchtower:       watchtowerrpc.NewWatchtowerClient(c),
×
71
                WatchtowerClient: wtclientrpc.NewWatchtowerClientClient(c),
×
72
                Signer:           signrpc.NewSignerClient(c),
×
73
                State:            lnrpc.NewStateClient(c),
×
74
                ChainClient:      chainrpc.NewChainNotifierClient(c),
×
75
                ChainKit:         chainrpc.NewChainKitClient(c),
×
76
                NeutrinoKit:      neutrinorpc.NewNeutrinoKitClient(c),
×
77
                Peer:             peersrpc.NewPeersClient(c),
×
NEW
78
                Dev:              devrpc.NewDevClient(c),
×
79
                Name:             name,
×
80
        }
×
81

×
82
        // Inherit parent context.
×
83
        h.runCtx, h.cancel = context.WithCancel(ctxt)
×
84
        return h
×
85
}
×
86

87
// MakeOutpoint returns the outpoint of the channel's funding transaction.
88
func (h *HarnessRPC) MakeOutpoint(cp *lnrpc.ChannelPoint) wire.OutPoint {
×
89
        fundingTxID, err := lnrpc.GetChanPointFundingTxid(cp)
×
90
        require.NoErrorf(h, err, "failed to make chanPoint", h.Name)
×
91

×
92
        return wire.OutPoint{
×
93
                Hash:  *fundingTxID,
×
94
                Index: cp.OutputIndex,
×
95
        }
×
96
}
×
97

98
// NoError is a helper method to format the error message used in calling RPCs.
99
func (h *HarnessRPC) NoError(err error, operation string) {
×
100
        require.NoErrorf(h, err, "%s: failed to call %s", h.Name, operation)
×
101
}
×
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