Skip to content

Commit 139eac6

Browse files
authored
Merge pull request #426 from lightninglabs/lnd-14
multi: bump lnd compile time dependency to v0.14.0-beta.rc1
2 parents 6b04d8e + 2c6e035 commit 139eac6

File tree

9 files changed

+250
-63
lines changed

9 files changed

+250
-63
lines changed

cmd/loop/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,10 @@ func readMacaroon(macPath string) (grpc.DialOption, error) {
434434
}
435435

436436
// Now we append the macaroon credentials to the dial options.
437-
cred := macaroons.NewMacaroonCredential(constrainedMac)
437+
cred, err := macaroons.NewMacaroonCredential(constrainedMac)
438+
if err != nil {
439+
return nil, fmt.Errorf("error creating macaroon credential: %v",
440+
err)
441+
}
438442
return grpc.WithPerRPCCredentials(cred), nil
439443
}

go.mod

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
module github.com/lightninglabs/loop
22

33
require (
4-
github.com/btcsuite/btcd v0.21.0-beta.0.20210513141527-ee5896bad5be
4+
github.com/btcsuite/btcd v0.22.0-beta.0.20211005184431-e3449998be39
55
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
66
github.com/btcsuite/btcutil v1.0.3-0.20210527170813-e2ba6805a890
7-
github.com/btcsuite/btcwallet/wtxmgr v1.3.1-0.20210706234807-aaf03fee735a
7+
github.com/btcsuite/btcwallet/wtxmgr v1.3.1-0.20210822222949-9b5a201c344c
88
github.com/coreos/bbolt v1.3.3
99
github.com/fortytw2/leaktest v1.3.0
1010
github.com/grpc-ecosystem/grpc-gateway/v2 v2.5.0
1111
github.com/jessevdk/go-flags v1.4.0
1212
github.com/lightninglabs/aperture v0.1.6-beta
13-
github.com/lightninglabs/lndclient v0.12.0-13
13+
github.com/lightninglabs/lndclient v0.14.0-3
1414
github.com/lightninglabs/protobuf-hex-display v1.4.3-hex-display
15-
github.com/lightningnetwork/lnd v0.13.0-beta.rc5.0.20210728112744-ebabda671786
16-
github.com/lightningnetwork/lnd/cert v1.0.3
17-
github.com/lightningnetwork/lnd/clock v1.0.1
18-
github.com/lightningnetwork/lnd/queue v1.0.4
19-
github.com/lightningnetwork/lnd/ticker v1.0.0
15+
github.com/lightningnetwork/lnd v0.14.0-beta.rc1
16+
github.com/lightningnetwork/lnd/cert v1.1.0
17+
github.com/lightningnetwork/lnd/clock v1.1.0
18+
github.com/lightningnetwork/lnd/kvdb v1.2.0
19+
github.com/lightningnetwork/lnd/queue v1.1.0
20+
github.com/lightningnetwork/lnd/ticker v1.1.0
2021
github.com/stretchr/testify v1.7.0
2122
github.com/urfave/cli v1.20.0
22-
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4
23+
golang.org/x/net v0.0.0-20210913180222-943fd674d43e
2324
google.golang.org/grpc v1.38.0
2425
google.golang.org/protobuf v1.26.0
2526
gopkg.in/macaroon-bakery.v2 v2.0.1

go.sum

Lines changed: 185 additions & 43 deletions
Large diffs are not rendered by default.

loopd/config.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ var (
7272
DefaultMacaroonPath = filepath.Join(
7373
LoopDirBase, DefaultNetwork, DefaultMacaroonFilename,
7474
)
75+
76+
// DefaultAutogenValidity is the default validity of a self-signed
77+
// certificate. The value corresponds to 14 months
78+
// (14 months * 30 days * 24 hours).
79+
DefaultAutogenValidity = 14 * 30 * 24 * time.Hour
7580
)
7681

7782
type lndConfig struct {
@@ -345,7 +350,7 @@ func loadCertWithCreate(cfg *Config) (tls.Certificate, *x509.Certificate,
345350
defaultSelfSignedOrganization, cfg.TLSCertPath,
346351
cfg.TLSKeyPath, cfg.TLSExtraIPs,
347352
cfg.TLSExtraDomains, cfg.TLSDisableAutofill,
348-
cert.DefaultAutogenValidity,
353+
DefaultAutogenValidity,
349354
)
350355
if err != nil {
351356
return tls.Certificate{}, nil, err

loopd/daemon.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"github.com/lightninglabs/lndclient"
1717
"github.com/lightninglabs/loop"
1818
"github.com/lightninglabs/loop/looprpc"
19+
"github.com/lightningnetwork/lnd/kvdb"
1920
"github.com/lightningnetwork/lnd/lntypes"
2021
"github.com/lightningnetwork/lnd/macaroons"
2122
"google.golang.org/grpc"
@@ -85,6 +86,7 @@ type Daemon struct {
8586
restCtxCancel func()
8687

8788
macaroonService *macaroons.Service
89+
macaroonDB kvdb.Backend
8890
}
8991

9092
// New creates a new instance of the loop client daemon.

loopd/macaroons.go

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88

99
"github.com/coreos/bbolt"
1010
"github.com/lightninglabs/loop/loopdb"
11+
"github.com/lightningnetwork/lnd/kvdb"
1112
"github.com/lightningnetwork/lnd/lnrpc"
1213
"github.com/lightningnetwork/lnd/macaroons"
1314
"github.com/lightningnetwork/lnd/rpcperms"
@@ -151,18 +152,27 @@ var (
151152
// exist yet. If macaroons are disabled in general in the configuration, none of
152153
// these actions are taken.
153154
func (d *Daemon) startMacaroonService() error {
154-
// Create the macaroon authentication/authorization service.
155155
var err error
156-
d.macaroonService, err = macaroons.NewService(
157-
d.cfg.DataDir, loopMacaroonLocation, false,
158-
loopdb.DefaultLoopDBTimeout, macaroons.IPLockChecker,
159-
)
156+
d.macaroonDB, err = kvdb.GetBoltBackend(&kvdb.BoltBackendConfig{
157+
DBPath: d.cfg.DataDir,
158+
DBFileName: "macaroons.db",
159+
DBTimeout: loopdb.DefaultLoopDBTimeout,
160+
})
161+
if err != nil {
162+
return fmt.Errorf("unable to load macaroon db: %v", err)
163+
}
160164
if err == bbolt.ErrTimeout {
161165
return fmt.Errorf("%w: couldn't obtain exclusive lock on "+
162166
"%s/%s, timed out after %v", bbolt.ErrTimeout,
163167
d.cfg.DataDir, "macaroons.db",
164168
loopdb.DefaultLoopDBTimeout)
165169
}
170+
171+
// Create the macaroon authentication/authorization service.
172+
d.macaroonService, err = macaroons.NewService(
173+
d.macaroonDB, loopMacaroonLocation, false,
174+
macaroons.IPLockChecker,
175+
)
166176
if err != nil {
167177
return fmt.Errorf("unable to set up macaroon authentication: "+
168178
"%v", err)
@@ -213,7 +223,18 @@ func (d *Daemon) startMacaroonService() error {
213223

214224
// stopMacaroonService closes the macaroon database.
215225
func (d *Daemon) stopMacaroonService() error {
216-
return d.macaroonService.Close()
226+
var shutdownErr error
227+
if err := d.macaroonService.Close(); err != nil {
228+
log.Errorf("Error closing macaroon service: %v", err)
229+
shutdownErr = err
230+
}
231+
232+
if err := d.macaroonDB.Close(); err != nil {
233+
log.Errorf("Error closing macaroon DB: %v", err)
234+
shutdownErr = err
235+
}
236+
237+
return shutdownErr
217238
}
218239

219240
// macaroonInterceptor creates gRPC server options with the macaroon security
@@ -225,7 +246,7 @@ func (d *Daemon) macaroonInterceptor() ([]grpc.ServerOption, error) {
225246
RequiredPermissions[endpoint] = perm
226247
}
227248

228-
interceptor := rpcperms.NewInterceptorChain(log, false)
249+
interceptor := rpcperms.NewInterceptorChain(log, false, nil)
229250
err := interceptor.Start()
230251
if err != nil {
231252
return nil, err

release_notes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ This file tracks release notes for the loop client.
2929
#### Bug Fixes
3030

3131
#### Maintenance
32+
33+
* Updated compile time dependencies of `lnd` to `v0.14.0-beta.rc1`.

swap_server_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ func getSwapServerConn(address, proxyAddress string, insecure bool,
693693
address, proxyAddress)
694694
torDialer := func(_ context.Context, addr string) (net.Conn, error) {
695695
return tor.Dial(
696-
addr, proxyAddress, false,
696+
addr, proxyAddress, false, false,
697697
tor.DefaultConnTimeout,
698698
)
699699
}

test/walletkit_mock.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/btcsuite/btcwallet/wtxmgr"
1414
"github.com/lightninglabs/lndclient"
1515
"github.com/lightningnetwork/lnd/keychain"
16+
"github.com/lightningnetwork/lnd/lnrpc/walletrpc"
1617
"github.com/lightningnetwork/lnd/lnwallet"
1718
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
1819
)
@@ -38,7 +39,7 @@ func (m *mockWalletKit) ListUnspent(ctx context.Context, minConfs,
3839
}
3940

4041
func (m *mockWalletKit) LeaseOutput(ctx context.Context, lockID wtxmgr.LockID,
41-
op wire.OutPoint) (time.Time, error) {
42+
op wire.OutPoint, duration time.Duration) (time.Time, error) {
4243

4344
return time.Now(), nil
4445
}
@@ -161,3 +162,12 @@ func (m *mockWalletKit) BumpFee(context.Context, wire.OutPoint,
161162

162163
return nil
163164
}
165+
166+
// ListAccounts retrieves all accounts belonging to the wallet by default.
167+
// Optional name and addressType can be provided to filter through all of the
168+
// wallet accounts and return only those matching.
169+
func (m *mockWalletKit) ListAccounts(context.Context, string,
170+
walletrpc.AddressType) ([]*walletrpc.Account, error) {
171+
172+
return nil, nil
173+
}

0 commit comments

Comments
 (0)