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

lightningnetwork / lnd / 15561477203

10 Jun 2025 01:54PM UTC coverage: 58.351% (-10.1%) from 68.487%
15561477203

Pull #9356

github

web-flow
Merge 6440b25db into c6d6d4c0b
Pull Request #9356: lnrpc: add incoming/outgoing channel ids filter to forwarding history request

33 of 36 new or added lines in 2 files covered. (91.67%)

28366 existing lines in 455 files now uncovered.

97715 of 167461 relevant lines covered (58.35%)

1.81 hits per line

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

0.0
/lnwallet/chancloser/mock.go
1
package chancloser
2

3
import (
4
        "sync/atomic"
5

6
        "github.com/btcsuite/btcd/btcec/v2"
7
        "github.com/btcsuite/btcd/btcutil"
8
        "github.com/btcsuite/btcd/chaincfg/chainhash"
9
        "github.com/btcsuite/btcd/wire"
10
        "github.com/lightningnetwork/lnd/chainntnfs"
11
        "github.com/lightningnetwork/lnd/channeldb"
12
        "github.com/lightningnetwork/lnd/fn/v2"
13
        "github.com/lightningnetwork/lnd/input"
14
        "github.com/lightningnetwork/lnd/lnwallet"
15
        "github.com/lightningnetwork/lnd/lnwallet/chainfee"
16
        "github.com/lightningnetwork/lnd/lnwire"
17
        "github.com/stretchr/testify/mock"
18
)
19

20
type dummyAdapters struct {
21
        mock.Mock
22

23
        msgSent atomic.Bool
24

25
        confChan  chan *chainntnfs.TxConfirmation
26
        spendChan chan *chainntnfs.SpendDetail
27
}
28

UNCOV
29
func newDaemonAdapters() *dummyAdapters {
×
UNCOV
30
        return &dummyAdapters{
×
UNCOV
31
                confChan:  make(chan *chainntnfs.TxConfirmation, 1),
×
UNCOV
32
                spendChan: make(chan *chainntnfs.SpendDetail, 1),
×
UNCOV
33
        }
×
UNCOV
34
}
×
35

36
func (d *dummyAdapters) SendMessages(pub btcec.PublicKey,
UNCOV
37
        msgs []lnwire.Message) error {
×
UNCOV
38

×
UNCOV
39
        defer d.msgSent.Store(true)
×
UNCOV
40

×
UNCOV
41
        args := d.Called(pub, msgs)
×
UNCOV
42

×
UNCOV
43
        return args.Error(0)
×
UNCOV
44
}
×
45

46
func (d *dummyAdapters) BroadcastTransaction(tx *wire.MsgTx,
UNCOV
47
        label string) error {
×
UNCOV
48

×
UNCOV
49
        args := d.Called(tx, label)
×
UNCOV
50

×
UNCOV
51
        return args.Error(0)
×
UNCOV
52
}
×
53

54
func (d *dummyAdapters) DisableChannel(op wire.OutPoint) error {
×
55
        args := d.Called(op)
×
56

×
57
        return args.Error(0)
×
58
}
×
59

60
func (d *dummyAdapters) RegisterConfirmationsNtfn(txid *chainhash.Hash,
61
        pkScript []byte, numConfs, heightHint uint32,
62
        opts ...chainntnfs.NotifierOption,
63
) (*chainntnfs.ConfirmationEvent, error) {
×
64

×
65
        args := d.Called(txid, pkScript, numConfs)
×
66

×
67
        err := args.Error(0)
×
68

×
69
        return &chainntnfs.ConfirmationEvent{
×
70
                Confirmed: d.confChan,
×
71
        }, err
×
72
}
×
73

74
func (d *dummyAdapters) RegisterSpendNtfn(outpoint *wire.OutPoint,
UNCOV
75
        pkScript []byte, heightHint uint32) (*chainntnfs.SpendEvent, error) {
×
UNCOV
76

×
UNCOV
77
        args := d.Called(outpoint, pkScript, heightHint)
×
UNCOV
78

×
UNCOV
79
        err := args.Error(0)
×
UNCOV
80

×
UNCOV
81
        return &chainntnfs.SpendEvent{
×
UNCOV
82
                Spend: d.spendChan,
×
UNCOV
83
        }, err
×
UNCOV
84
}
×
85

86
type mockFeeEstimator struct {
87
        mock.Mock
88
}
89

90
func (m *mockFeeEstimator) EstimateFee(chanType channeldb.ChannelType,
91
        localTxOut, remoteTxOut *wire.TxOut,
UNCOV
92
        idealFeeRate chainfee.SatPerKWeight) btcutil.Amount {
×
UNCOV
93

×
UNCOV
94
        args := m.Called(chanType, localTxOut, remoteTxOut, idealFeeRate)
×
UNCOV
95
        return args.Get(0).(btcutil.Amount)
×
UNCOV
96
}
×
97

98
type mockChanObserver struct {
99
        mock.Mock
100
}
101

UNCOV
102
func (m *mockChanObserver) NoDanglingUpdates() bool {
×
UNCOV
103
        args := m.Called()
×
UNCOV
104
        return args.Bool(0)
×
UNCOV
105
}
×
106

UNCOV
107
func (m *mockChanObserver) DisableIncomingAdds() error {
×
UNCOV
108
        args := m.Called()
×
UNCOV
109
        return args.Error(0)
×
UNCOV
110
}
×
111

UNCOV
112
func (m *mockChanObserver) DisableOutgoingAdds() error {
×
UNCOV
113
        args := m.Called()
×
UNCOV
114
        return args.Error(0)
×
UNCOV
115
}
×
116

117
func (m *mockChanObserver) MarkCoopBroadcasted(txn *wire.MsgTx,
UNCOV
118
        local bool) error {
×
UNCOV
119

×
UNCOV
120
        args := m.Called(txn, local)
×
UNCOV
121
        return args.Error(0)
×
UNCOV
122
}
×
123

124
func (m *mockChanObserver) MarkShutdownSent(deliveryAddr []byte,
UNCOV
125
        isInitiator bool) error {
×
UNCOV
126

×
UNCOV
127
        args := m.Called(deliveryAddr, isInitiator)
×
UNCOV
128
        return args.Error(0)
×
UNCOV
129
}
×
130

UNCOV
131
func (m *mockChanObserver) FinalBalances() fn.Option[ShutdownBalances] {
×
UNCOV
132
        args := m.Called()
×
UNCOV
133
        return args.Get(0).(fn.Option[ShutdownBalances])
×
UNCOV
134
}
×
135

UNCOV
136
func (m *mockChanObserver) DisableChannel() error {
×
UNCOV
137
        args := m.Called()
×
UNCOV
138
        return args.Error(0)
×
UNCOV
139
}
×
140

141
type mockErrorReporter struct {
142
        mock.Mock
143
}
144

UNCOV
145
func (m *mockErrorReporter) ReportError(err error) {
×
UNCOV
146
        m.Called(err)
×
UNCOV
147
}
×
148

149
type mockCloseSigner struct {
150
        mock.Mock
151
}
152

153
func (m *mockCloseSigner) CreateCloseProposal(fee btcutil.Amount,
154
        localScript []byte, remoteScript []byte,
155
        closeOpt ...lnwallet.ChanCloseOpt) (
UNCOV
156
        input.Signature, *wire.MsgTx, btcutil.Amount, error) {
×
UNCOV
157

×
UNCOV
158
        args := m.Called(fee, localScript, remoteScript, closeOpt)
×
UNCOV
159

×
UNCOV
160
        return args.Get(0).(input.Signature), args.Get(1).(*wire.MsgTx),
×
UNCOV
161
                args.Get(2).(btcutil.Amount), args.Error(3)
×
UNCOV
162
}
×
163

164
func (m *mockCloseSigner) CompleteCooperativeClose(localSig,
165
        remoteSig input.Signature,
166
        localScript, remoteScript []byte,
167
        fee btcutil.Amount, closeOpt ...lnwallet.ChanCloseOpt,
UNCOV
168
) (*wire.MsgTx, btcutil.Amount, error) {
×
UNCOV
169

×
UNCOV
170
        args := m.Called(
×
UNCOV
171
                localSig, remoteSig, localScript, remoteScript, fee, closeOpt,
×
UNCOV
172
        )
×
UNCOV
173

×
UNCOV
174
        return args.Get(0).(*wire.MsgTx), args.Get(1).(btcutil.Amount),
×
UNCOV
175
                args.Error(2)
×
UNCOV
176
}
×
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