Skip to content

Commit d85cc01

Browse files
authored
Merge pull request #327 from carlaKC/325-waitunlocked
loopd: wait for lnd to be unlocked on startup
2 parents a673e0b + bd57c2c commit d85cc01

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/golang/protobuf v1.3.2
1111
github.com/grpc-ecosystem/grpc-gateway v1.14.3
1212
github.com/jessevdk/go-flags v1.4.0
13-
github.com/lightninglabs/lndclient v0.11.0-3
13+
github.com/lightninglabs/lndclient v0.11.0-5
1414
github.com/lightninglabs/protobuf-hex-display v1.3.3-0.20191212020323-b444784ce75d
1515
github.com/lightningnetwork/lnd v0.12.0-beta.rc3
1616
github.com/lightningnetwork/lnd/cert v1.0.3

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
182182
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
183183
github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf h1:HZKvJUHlcXI/f/O0Avg7t8sqkPo78HFzjmeYFl6DPnc=
184184
github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf/go.mod h1:vxmQPeIQxPf6Jf9rM8R+B4rKBqLA2AjttNxkFBL2Plk=
185-
github.com/lightninglabs/lndclient v0.11.0-3 h1:x8co3UOeaUwh0iBFNeaPaqJsg8gvlgV/+fQHp2MT9eI=
186-
github.com/lightninglabs/lndclient v0.11.0-3/go.mod h1:8/cTKNwgL87NX123gmlv3Xh6p1a7pvzu+40Un3PhHiI=
185+
github.com/lightninglabs/lndclient v0.11.0-5 h1:nHDit/3siG8wvzbQPiyGVpu9v5llqThJK1KmG/IZTIw=
186+
github.com/lightninglabs/lndclient v0.11.0-5/go.mod h1:nIQ+lDm7JGRmP7OSeVfhOAyoqD4GA4NYU8GTsTXITbE=
187187
github.com/lightninglabs/neutrino v0.11.0/go.mod h1:CuhF0iuzg9Sp2HO6ZgXgayviFTn1QHdSTJlMncK80wg=
188188
github.com/lightninglabs/neutrino v0.11.1-0.20200316235139-bffc52e8f200 h1:j4iZ1XlUAPQmW6oSzMcJGILYsRHNs+4O3Gk+2Ms5Dww=
189189
github.com/lightninglabs/neutrino v0.11.1-0.20200316235139-bffc52e8f200/go.mod h1:MlZmoKa7CJP3eR1s5yB7Rm5aSyadpKkxqAwLQmog7N0=

loopd/run.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func newListenerCfg(config *Config, rpcCfg RPCConfig) *listenerCfg {
8282
getLnd: func(network lndclient.Network, cfg *lndConfig) (
8383
*lndclient.GrpcLndServices, error) {
8484

85-
syncCtx, cancel := context.WithCancel(
85+
callerCtx, cancel := context.WithCancel(
8686
context.Background(),
8787
)
8888
defer cancel()
@@ -94,7 +94,8 @@ func newListenerCfg(config *Config, rpcCfg RPCConfig) *listenerCfg {
9494
TLSPath: cfg.TLSPath,
9595
CheckVersion: LoopMinRequiredLndVersion,
9696
BlockUntilChainSynced: true,
97-
ChainSyncCtx: syncCtx,
97+
CallerCtx: callerCtx,
98+
BlockUntilUnlocked: true,
9899
}
99100

100101
// If a custom lnd connection is specified we use that
@@ -120,7 +121,7 @@ func newListenerCfg(config *Config, rpcCfg RPCConfig) *listenerCfg {
120121
// If our sync context was cancelled, we know
121122
// that the function exited, which means that
122123
// our client synced.
123-
case <-syncCtx.Done():
124+
case <-callerCtx.Done():
124125
}
125126
}()
126127

release_notes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ This file tracks release notes for the loop client.
1616
- Fixed compile time compatibility with `lnd v0.12.0-beta`.
1717

1818
#### New Features
19+
* If lnd is locked when the loop client starts up, it will wait for lnd to be
20+
unlocked. Previous versions would exit with an error.
1921

2022
#### Breaking Changes
2123

test/router_mock.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
)
88

99
type mockRouter struct {
10+
lndclient.RouterClient
1011
lnd *LndMockServices
1112
}
1213

0 commit comments

Comments
 (0)