lntest/node: call FetchNode info in wait.NoError after init

In case we call it before the RPC server is fully active.
This commit is contained in:
Johan T. Halseth 2021-02-05 13:30:59 +01:00
parent 4bbf5c4b6d
commit 5e9e03858d
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -801,8 +801,9 @@ func (hn *HarnessNode) initLightningClient(conn *grpc.ClientConn) error {
hn.SignerClient = signrpc.NewSignerClient(conn) hn.SignerClient = signrpc.NewSignerClient(conn)
// Set the harness node's pubkey to what the node claims in GetInfo. // Set the harness node's pubkey to what the node claims in GetInfo.
err := hn.FetchNodeInfo() // Since the RPC might not be immediately active, we wrap the call in a
if err != nil { // wait.NoError.
if err := wait.NoError(hn.FetchNodeInfo, DefaultTimeout); err != nil {
return err return err
} }
@ -812,7 +813,7 @@ func (hn *HarnessNode) initLightningClient(conn *grpc.ClientConn) error {
// until then, we'll create a dummy subscription to ensure we can do so // until then, we'll create a dummy subscription to ensure we can do so
// successfully before proceeding. We use a dummy subscription in order // successfully before proceeding. We use a dummy subscription in order
// to not consume an update from the real one. // to not consume an update from the real one.
err = wait.NoError(func() error { err := wait.NoError(func() error {
req := &lnrpc.GraphTopologySubscription{} req := &lnrpc.GraphTopologySubscription{}
ctx, cancelFunc := context.WithCancel(context.Background()) ctx, cancelFunc := context.WithCancel(context.Background())
topologyClient, err := hn.SubscribeChannelGraph(ctx, req) topologyClient, err := hn.SubscribeChannelGraph(ctx, req)