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

lightningnetwork / lnd / 15951470896

29 Jun 2025 04:23AM UTC coverage: 67.594% (-0.01%) from 67.606%
15951470896

Pull #9751

github

web-flow
Merge 599d9b051 into 6290edf14
Pull Request #9751: multi: update Go to 1.23.10 and update some packages

135088 of 199851 relevant lines covered (67.59%)

21909.44 hits per line

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

59.26
/lnwallet/btcwallet/driver.go
1
package btcwallet
2

3
import (
4
        "fmt"
5

6
        "github.com/btcsuite/btcwallet/chain"
7
        "github.com/lightningnetwork/lnd/blockcache"
8
        "github.com/lightningnetwork/lnd/lnwallet"
9
)
10

11
const (
12
        walletType = "btcwallet"
13
)
14

15
// createNewWallet creates a new instance of BtcWallet given the proper list of
16
// initialization parameters. This function is the factory function required to
17
// properly create an instance of the lnwallet.WalletDriver struct for
18
// BtcWallet.
19
func createNewWallet(args ...interface{}) (lnwallet.WalletController, error) {
8✔
20
        if len(args) != 2 {
8✔
21
                return nil, fmt.Errorf("incorrect number of arguments to .New(...), "+
×
22
                        "expected 2, instead passed %v", len(args))
×
23
        }
×
24

25
        config, ok := args[0].(*Config)
8✔
26
        if !ok {
8✔
27
                return nil, fmt.Errorf("first argument to btcdnotifier.New is " +
×
28
                        "incorrect, expected a *rpcclient.ConnConfig")
×
29
        }
×
30

31
        blockCache, ok := args[1].(*blockcache.BlockCache)
8✔
32
        if !ok {
8✔
33
                return nil, fmt.Errorf("second argument to btcdnotifier.New is " +
×
34
                        "incorrect, expected a *blockcache.BlockCache")
×
35
        }
×
36

37
        return New(*config, blockCache)
8✔
38
}
39

40
// init registers a driver for the BtcWallet concrete implementation of the
41
// lnwallet.WalletController interface.
42
func init() {
18✔
43
        // Register the driver.
18✔
44
        driver := &lnwallet.WalletDriver{
18✔
45
                WalletType: walletType,
18✔
46
                New:        createNewWallet,
18✔
47
                BackEnds:   chain.BackEnds,
18✔
48
        }
18✔
49

18✔
50
        if err := lnwallet.RegisterWallet(driver); err != nil {
18✔
51
                panic(fmt.Sprintf("failed to register wallet driver '%s': %v",
×
52
                        walletType, err))
×
53
        }
54
}
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