• 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
/lntest/mock/chainnotifier.go
1
package mock
2

3
import (
4
        "github.com/btcsuite/btcd/chaincfg/chainhash"
5
        "github.com/btcsuite/btcd/wire"
6
        "github.com/lightningnetwork/lnd/chainntnfs"
7
)
8

9
// ChainNotifier is a mock implementation of the ChainNotifier interface.
10
type ChainNotifier struct {
11
        SpendChan chan *chainntnfs.SpendDetail
12
        EpochChan chan *chainntnfs.BlockEpoch
13
        ConfChan  chan *chainntnfs.TxConfirmation
14
}
15

16
// RegisterConfirmationsNtfn returns a ConfirmationEvent that contains a channel
17
// that the tx confirmation will go over.
18
func (c *ChainNotifier) RegisterConfirmationsNtfn(txid *chainhash.Hash,
19
        pkScript []byte, numConfs, heightHint uint32,
UNCOV
20
        opts ...chainntnfs.NotifierOption) (*chainntnfs.ConfirmationEvent, error) {
×
UNCOV
21

×
UNCOV
22
        return &chainntnfs.ConfirmationEvent{
×
UNCOV
23
                Confirmed: c.ConfChan,
×
UNCOV
24
                Cancel:    func() {},
×
25
        }, nil
26
}
27

28
// RegisterSpendNtfn returns a SpendEvent that contains a channel that the spend
29
// details will go over.
30
func (c *ChainNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint,
UNCOV
31
        pkScript []byte, heightHint uint32) (*chainntnfs.SpendEvent, error) {
×
UNCOV
32

×
UNCOV
33
        return &chainntnfs.SpendEvent{
×
UNCOV
34
                Spend:  c.SpendChan,
×
UNCOV
35
                Cancel: func() {},
×
36
        }, nil
37
}
38

39
// RegisterBlockEpochNtfn returns a BlockEpochEvent that contains a channel that
40
// block epochs will go over.
41
func (c *ChainNotifier) RegisterBlockEpochNtfn(blockEpoch *chainntnfs.BlockEpoch) (
UNCOV
42
        *chainntnfs.BlockEpochEvent, error) {
×
UNCOV
43

×
UNCOV
44
        return &chainntnfs.BlockEpochEvent{
×
UNCOV
45
                Epochs: c.EpochChan,
×
UNCOV
46
                Cancel: func() {},
×
47
        }, nil
48
}
49

50
// Start currently returns a dummy value.
51
func (c *ChainNotifier) Start() error {
×
52
        return nil
×
53
}
×
54

55
// Started currently returns a dummy value.
56
func (c *ChainNotifier) Started() bool {
×
57
        return true
×
58
}
×
59

60
// Stop currently returns a dummy value.
61
func (c *ChainNotifier) Stop() error {
×
62
        return nil
×
63
}
×
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