lntest/node: set up InvoicesClient for HarnessNode

This commit is contained in:
Johan T. Halseth
2019-05-06 12:19:36 +02:00
committed by Joost Jager
parent d8dac49112
commit b917820c5b

View File

@@ -27,6 +27,7 @@ import (
"github.com/go-errors/errors" "github.com/go-errors/errors"
"github.com/lightningnetwork/lnd/chanbackup" "github.com/lightningnetwork/lnd/chanbackup"
"github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/lnrpc/invoicesrpc"
"github.com/lightningnetwork/lnd/macaroons" "github.com/lightningnetwork/lnd/macaroons"
) )
@@ -240,11 +241,14 @@ type HarnessNode struct {
lnrpc.LightningClient lnrpc.LightningClient
lnrpc.WalletUnlockerClient lnrpc.WalletUnlockerClient
invoicesrpc.InvoicesClient
} }
// Assert *HarnessNode implements the lnrpc.LightningClient interface. // Assert *HarnessNode implements the lnrpc.LightningClient interface.
var _ lnrpc.LightningClient = (*HarnessNode)(nil) var _ lnrpc.LightningClient = (*HarnessNode)(nil)
var _ lnrpc.WalletUnlockerClient = (*HarnessNode)(nil) var _ lnrpc.WalletUnlockerClient = (*HarnessNode)(nil)
var _ invoicesrpc.InvoicesClient = (*HarnessNode)(nil)
// newNode creates a new test lightning node instance from the passed config. // newNode creates a new test lightning node instance from the passed config.
func newNode(cfg nodeConfig) (*HarnessNode, error) { func newNode(cfg nodeConfig) (*HarnessNode, error) {
@@ -487,6 +491,7 @@ func (hn *HarnessNode) initLightningClient(conn *grpc.ClientConn) error {
// Construct the LightningClient that will allow us to use the // Construct the LightningClient that will allow us to use the
// HarnessNode directly for normal rpc operations. // HarnessNode directly for normal rpc operations.
hn.LightningClient = lnrpc.NewLightningClient(conn) hn.LightningClient = lnrpc.NewLightningClient(conn)
hn.InvoicesClient = invoicesrpc.NewInvoicesClient(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() err := hn.FetchNodeInfo()