• 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
/lnwallet/btcwallet/config.go
1
package btcwallet
2

3
import (
4
        "path/filepath"
5
        "time"
6

7
        "github.com/btcsuite/btcd/chaincfg"
8
        "github.com/btcsuite/btcd/wire"
9
        "github.com/btcsuite/btcwallet/chain"
10
        "github.com/btcsuite/btcwallet/wallet"
11
)
12

13
var (
14
        // defaultPubPassphrase is the default public wallet passphrase which is
15
        // used when the user indicates they do not want additional protection
16
        // provided by having all public data in the wallet encrypted by a
17
        // passphrase only known to them.
18
        defaultPubPassphrase = []byte("public")
19
)
20

21
// Config is a struct which houses configuration parameters which modify the
22
// instance of BtcWallet generated by the New() function.
23
type Config struct {
24
        // LogDir is the name of the directory which should be used to store
25
        // generated log files.
26
        LogDir string
27

28
        // PrivatePass is the private password to the underlying btcwallet
29
        // instance. Without this, the wallet cannot be decrypted and operated.
30
        PrivatePass []byte
31

32
        // PublicPass is the optional public password to btcwallet. This is
33
        // optionally used to encrypt public material such as public keys and
34
        // scripts.
35
        PublicPass []byte
36

37
        // HdSeed is an optional seed to feed into the wallet. If this is
38
        // unspecified, a new seed will be generated.
39
        HdSeed []byte
40

41
        // Birthday specifies the time at which this wallet was initially
42
        // created. It is used to bound rescans for used addresses.
43
        Birthday time.Time
44

45
        // RecoveryWindow specifies the address look-ahead for which to scan
46
        // when restoring a wallet. The recovery window will apply to all
47
        // default BIP44 derivation paths.
48
        RecoveryWindow uint32
49

50
        // ChainSource is the primary chain interface. This is used to operate
51
        // the wallet and do things such as rescanning, sending transactions,
52
        // notifications for received funds, etc.
53
        ChainSource chain.Interface
54

55
        // NetParams is the net parameters for the target chain.
56
        NetParams *chaincfg.Params
57

58
        // CoinType specifies the BIP 44 coin type to be used for derivation.
59
        CoinType uint32
60

61
        // Wallet is an unlocked wallet instance that is set if the
62
        // UnlockerService has already opened and unlocked the wallet. If this
63
        // is nil, then a wallet might have just been created or is simply not
64
        // encrypted at all, in which case it should be attempted to be loaded
65
        // normally when creating the BtcWallet.
66
        Wallet *wallet.Wallet
67

68
        // LoaderOptions holds functional wallet db loader options.
69
        LoaderOptions []LoaderOption
70

71
        // CoinSelectionStrategy is the strategy that is used for selecting
72
        // coins when funding a transaction.
73
        CoinSelectionStrategy wallet.CoinSelectionStrategy
74

75
        // WatchOnly indicates that the wallet was initialized with public key
76
        // material only and does not contain any private keys.
77
        WatchOnly bool
78

79
        // MigrateWatchOnly indicates that if a wallet with private key material
80
        // already exists, it should be attempted to be converted into a
81
        // watch-only wallet on first startup. This flag has no effect if no
82
        // wallet exists and a watch-only one is created directly, or, if the
83
        // wallet was previously converted to a watch-only already.
84
        MigrateWatchOnly bool
85
}
86

87
// NetworkDir returns the directory name of a network directory to hold wallet
88
// files.
UNCOV
89
func NetworkDir(dataDir string, chainParams *chaincfg.Params) string {
×
UNCOV
90
        netname := chainParams.Name
×
UNCOV
91

×
UNCOV
92
        // For now, we must always name the testnet data directory as "testnet"
×
UNCOV
93
        // and not "testnet3" or any other version, as the chaincfg testnet3
×
UNCOV
94
        // parameters will likely be switched to being named "testnet3" in the
×
UNCOV
95
        // future.  This is done to future proof that change, and an upgrade
×
UNCOV
96
        // plan to move the testnet3 data directory can be worked out later.
×
UNCOV
97
        if chainParams.Net == wire.TestNet3 {
×
98
                netname = "testnet"
×
99
        }
×
100

UNCOV
101
        return filepath.Join(dataDir, netname)
×
102
}
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