• 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
/lnencrypt/test_utils.go
1
package lnencrypt
2

3
import (
4
        "fmt"
5

6
        "github.com/btcsuite/btcd/btcec/v2"
7
        "github.com/lightningnetwork/lnd/keychain"
8
)
9

10
var (
11
        testWalletPrivKey = []byte{
12
                0x2b, 0xd8, 0x06, 0xc9, 0x7f, 0x0e, 0x00, 0xaf,
13
                0x1a, 0x1f, 0xc3, 0x32, 0x8f, 0xa7, 0x63, 0xa9,
14
                0x26, 0x97, 0x23, 0xc8, 0xdb, 0x8f, 0xac, 0x4f,
15
                0x93, 0xaf, 0x71, 0xdb, 0x18, 0x6d, 0x6e, 0x90,
16
        }
17
)
18

19
type MockKeyRing struct {
20
        Fail bool
21
}
22

23
func (m *MockKeyRing) DeriveNextKey(
24
        keyFam keychain.KeyFamily) (keychain.KeyDescriptor, error) {
×
25

×
26
        return keychain.KeyDescriptor{}, nil
×
27
}
×
28

29
func (m *MockKeyRing) DeriveKey(
UNCOV
30
        keyLoc keychain.KeyLocator) (keychain.KeyDescriptor, error) {
×
UNCOV
31

×
UNCOV
32
        if m.Fail {
×
UNCOV
33
                return keychain.KeyDescriptor{}, fmt.Errorf("fail")
×
UNCOV
34
        }
×
35

UNCOV
36
        _, pub := btcec.PrivKeyFromBytes(testWalletPrivKey)
×
UNCOV
37
        return keychain.KeyDescriptor{
×
UNCOV
38
                PubKey: pub,
×
UNCOV
39
        }, nil
×
40
}
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