From 69ae56ad5c1227126797fbf6faaab985da5b2742 Mon Sep 17 00:00:00 2001 From: Harsha Goli Date: Mon, 13 Dec 2021 19:05:51 -0500 Subject: [PATCH] lntest: surface bitcoin backend rpc credentials [skip ci] --- lntest/bitcoind_common.go | 5 +++++ lntest/btcd.go | 5 +++++ lntest/harness_node.go | 4 ++++ lntest/neutrino.go | 6 ++++++ 4 files changed, 20 insertions(+) diff --git a/lntest/bitcoind_common.go b/lntest/bitcoind_common.go index d116ac686..6ec6bfdaf 100644 --- a/lntest/bitcoind_common.go +++ b/lntest/bitcoind_common.go @@ -64,6 +64,11 @@ func (b BitcoindBackendConfig) DisconnectMiner() error { return b.rpcClient.AddNode(b.minerAddr, rpcclient.ANRemove) } +// Credentials returns the rpc username, password and host for the backend. +func (b BitcoindBackendConfig) Credentials() (string, string, string, error) { + return b.rpcUser, b.rpcPass, b.rpcHost, nil +} + // Name returns the name of the backend type. func (b BitcoindBackendConfig) Name() string { return "bitcoind" diff --git a/lntest/btcd.go b/lntest/btcd.go index 1ac281787..200faa9bf 100644 --- a/lntest/btcd.go +++ b/lntest/btcd.go @@ -67,6 +67,11 @@ func (b BtcdBackendConfig) DisconnectMiner() error { return b.harness.Client.Node(btcjson.NDisconnect, b.minerAddr, &temp) } +// Credentials returns the rpc username, password and host for the backend. +func (b BtcdBackendConfig) Credentials() (string, string, string, error) { + return b.rpcConfig.User, b.rpcConfig.Pass, b.rpcConfig.Host, nil +} + // Name returns the name of the backend type. func (b BtcdBackendConfig) Name() string { return "btcd" diff --git a/lntest/harness_node.go b/lntest/harness_node.go index fd3e0ad3f..ccdd15795 100644 --- a/lntest/harness_node.go +++ b/lntest/harness_node.go @@ -82,6 +82,10 @@ type BackendConfig interface { // Name returns the name of the backend type. Name() string + + // Credentials returns the rpc username, password and host for the + // backend. + Credentials() (string, string, string, error) } // NodeConfig is the basic interface a node configuration must implement. diff --git a/lntest/neutrino.go b/lntest/neutrino.go index 6c8f7098a..64e880372 100644 --- a/lntest/neutrino.go +++ b/lntest/neutrino.go @@ -42,6 +42,12 @@ func (b NeutrinoBackendConfig) DisconnectMiner() error { return fmt.Errorf("unimplemented") } +// Credentials returns the rpc username, password and host for the backend. +// For neutrino, we return an error because there is no rpc client available. +func (b NeutrinoBackendConfig) Credentials() (string, string, string, error) { + return "", "", "", fmt.Errorf("unimplemented") +} + // Name returns the name of the backend type. func (b NeutrinoBackendConfig) Name() string { return NeutrinoBackendName