rpcperms+lnd: gate RPC calls on RPC state

This commit makes us gate the calls to the RPC servers according to the
current RPC state. This ensures we won't try to call the RPC server
before it has been fully initialized, and that we won't call the
walletUnlocker after the wallet already has been unlocked.
This commit is contained in:
Johan T. Halseth committed 2021-03-11 13:05:24 +01:00
1 parent 0d7763fb96
commit 2877511fce
3 files changed
+204 -28

No files matched your search

+6 -2
View File
@@ -300,8 +300,12 @@ func (n *NetworkHarness) NewNodeWithSeed(name string, extraArgs []string,
ctxt, cancel := context.WithTimeout(ctxb, DefaultTimeout)
defer cancel()
genSeedResp, err := node.GenSeed(ctxt, genSeedReq)
if err != nil {
var genSeedResp *lnrpc.GenSeedResponse
if err := wait.NoError(func() error {
genSeedResp, err = node.GenSeed(ctxt, genSeedReq)
return err
}, DefaultTimeout); err != nil {
return nil, nil, nil, err
}