lnd_test: use RegTest instead of SimNet during integration tests

This commit is contained in:
Johan T. Halseth 2019-07-11 13:51:22 +02:00
parent 81cb3cb739
commit 35f3544111
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26
3 changed files with 16 additions and 7 deletions

@ -67,7 +67,9 @@ func (b BtcdBackendConfig) Name() string {
// 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.
func NewBackend(miner string) (*BtcdBackendConfig, func(), error) { func NewBackend(miner string, netParams *chaincfg.Params) (
*BtcdBackendConfig, func(), error) {
args := []string{ args := []string{
"--rejectnonstd", "--rejectnonstd",
"--txindex", "--txindex",
@ -76,7 +78,6 @@ func NewBackend(miner string) (*BtcdBackendConfig, func(), error) {
"--logdir=" + logDir, "--logdir=" + logDir,
"--connect=" + miner, "--connect=" + miner,
} }
netParams := &chaincfg.SimNetParams
chainBackend, err := rpctest.New(netParams, nil, args) chainBackend, err := rpctest.New(netParams, nil, args)
if err != nil { if err != nil {
return nil, nil, fmt.Errorf("unable to create btcd node: %v", err) return nil, nil, fmt.Errorf("unable to create btcd node: %v", err)

@ -45,7 +45,7 @@ import (
) )
var ( var (
harnessNetParams = &chaincfg.SimNetParams harnessNetParams = &chaincfg.RegressionNetParams
) )
const ( const (
@ -14415,7 +14415,9 @@ func TestLightningNetworkDaemon(t *testing.T) {
}() }()
// Start a chain backend. // Start a chain backend.
chainBackend, cleanUp, err := lntest.NewBackend(miner.P2PAddress()) chainBackend, cleanUp, err := lntest.NewBackend(
miner.P2PAddress(), harnessNetParams,
)
if err != nil { if err != nil {
ht.Fatalf("unable to start backend: %v", err) ht.Fatalf("unable to start backend: %v", err)
} }
@ -14454,7 +14456,7 @@ func TestLightningNetworkDaemon(t *testing.T) {
// Next mine enough blocks in order for segwit and the CSV package // Next mine enough blocks in order for segwit and the CSV package
// soft-fork to activate on SimNet. // soft-fork to activate on SimNet.
numBlocks := chaincfg.SimNetParams.MinerConfirmationWindow * 2 numBlocks := harnessNetParams.MinerConfirmationWindow * 2
if _, err := miner.Node.Generate(numBlocks); err != nil { if _, err := miner.Node.Generate(numBlocks); err != nil {
ht.Fatalf("unable to generate blocks: %v", err) ht.Fatalf("unable to generate blocks: %v", err)
} }

@ -2,7 +2,11 @@
package lntest package lntest
import "fmt" import (
"fmt"
"github.com/btcsuite/btcd/chaincfg"
)
// NeutrinoBackendConfig is an implementation of the BackendConfig interface // NeutrinoBackendConfig is an implementation of the BackendConfig interface
// backed by a neutrino node. // backed by a neutrino node.
@ -35,7 +39,9 @@ func (b NeutrinoBackendConfig) Name() string {
} }
// NewBackend starts and returns a NeutrinoBackendConfig for the node. // NewBackend starts and returns a NeutrinoBackendConfig for the node.
func NewBackend(miner string) (*NeutrinoBackendConfig, func(), error) { func NewBackend(miner string, _ *chaincfg.Params) (
*NeutrinoBackendConfig, func(), error) {
bd := &NeutrinoBackendConfig{ bd := &NeutrinoBackendConfig{
minerAddr: miner, minerAddr: miner,
} }