mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-31 08:02:25 +02:00
lntest: add method P2PAddr to backend
It is useful if we want to keep bitcoind main itest mode, but connect one node using neutrino.
This commit is contained in:
@@ -85,6 +85,11 @@ func (b BitcoindBackendConfig) Name() string {
|
|||||||
return "bitcoind"
|
return "bitcoind"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// P2PAddr return bitcoin p2p ip:port.
|
||||||
|
func (b BitcoindBackendConfig) P2PAddr() (string, error) {
|
||||||
|
return fmt.Sprintf("127.0.0.1:%d", b.p2pPort), nil
|
||||||
|
}
|
||||||
|
|
||||||
// newBackend starts a bitcoind node with the given extra parameters and returns
|
// newBackend starts a bitcoind node with the given extra parameters and returns
|
||||||
// a BitcoindBackendConfig for that node.
|
// a BitcoindBackendConfig for that node.
|
||||||
func newBackend(miner string, netParams *chaincfg.Params, extraArgs []string,
|
func newBackend(miner string, netParams *chaincfg.Params, extraArgs []string,
|
||||||
|
@@ -74,6 +74,11 @@ func (b BtcdBackendConfig) Name() string {
|
|||||||
return "btcd"
|
return "btcd"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// P2PAddr return bitcoin p2p ip:port.
|
||||||
|
func (b BtcdBackendConfig) P2PAddr() (string, error) {
|
||||||
|
return b.harness.P2PAddress(), nil
|
||||||
|
}
|
||||||
|
|
||||||
// NewBackend starts a new rpctest.Harness and returns a BtcdBackendConfig for
|
// NewBackend starts a new rpctest.Harness and returns a BtcdBackendConfig for
|
||||||
// that node. miner should be set to the P2P address of the miner to connect
|
// that node. miner should be set to the P2P address of the miner to connect
|
||||||
// to.
|
// to.
|
||||||
|
@@ -54,6 +54,11 @@ func (b NeutrinoBackendConfig) Name() string {
|
|||||||
return NeutrinoBackendName
|
return NeutrinoBackendName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// P2PAddr return bitcoin p2p ip:port.
|
||||||
|
func (b NeutrinoBackendConfig) P2PAddr() (string, error) {
|
||||||
|
return b.minerAddr, nil
|
||||||
|
}
|
||||||
|
|
||||||
// NewBackend starts and returns a NeutrinoBackendConfig for the node.
|
// NewBackend starts and returns a NeutrinoBackendConfig for the node.
|
||||||
func NewBackend(miner string, _ *chaincfg.Params) (
|
func NewBackend(miner string, _ *chaincfg.Params) (
|
||||||
*NeutrinoBackendConfig, func() error, error) {
|
*NeutrinoBackendConfig, func() error, error) {
|
||||||
|
@@ -114,6 +114,9 @@ type BackendConfig interface {
|
|||||||
// Credentials returns the rpc username, password and host for the
|
// Credentials returns the rpc username, password and host for the
|
||||||
// backend.
|
// backend.
|
||||||
Credentials() (string, string, string, error)
|
Credentials() (string, string, string, error)
|
||||||
|
|
||||||
|
// P2PAddr return bitcoin p2p ip:port.
|
||||||
|
P2PAddr() (string, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// BaseNodeConfig is the base node configuration.
|
// BaseNodeConfig is the base node configuration.
|
||||||
|
Reference in New Issue
Block a user