lntemp+itest: remove unused code to prepare lntemp's takeover

This commit removes the old code living in `lntest` to prepare
`lntemp`'s takeover.
This commit is contained in:
yyforyongyu committed 2023-02-23 21:56:08 +08:00
1 parent 106fbeae85
commit 94c64a886e
30 files changed
+305 -6533

No files matched your search

+16 -9
View File
@@ -15,6 +15,7 @@ import (
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/integration/rpctest"
"github.com/btcsuite/btcd/rpcclient"
"github.com/lightningnetwork/lnd/lntemp/node"
)
// logDirPattern is the pattern of the name of the temporary log directory.
@@ -41,7 +42,7 @@ type BtcdBackendConfig struct {
// A compile time assertion to ensure BtcdBackendConfig meets the BackendConfig
// interface.
var _ BackendConfig = (*BtcdBackendConfig)(nil)
var _ node.BackendConfig = (*BtcdBackendConfig)(nil)
// GenArgs returns the arguments needed to be passed to LND at startup for
// using this node as a chain backend.
@@ -83,7 +84,7 @@ func (b BtcdBackendConfig) Name() string {
func NewBackend(miner string, netParams *chaincfg.Params) (
*BtcdBackendConfig, func() error, error) {
baseLogDir := fmt.Sprintf(logDirPattern, GetLogDir())
baseLogDir := fmt.Sprintf(logDirPattern, node.GetLogDir())
args := []string{
"--rejectnonstd",
"--txindex",
@@ -98,9 +99,12 @@ func NewBackend(miner string, netParams *chaincfg.Params) (
// Don't disconnect if a reply takes too long.
"--nostalldetect",
}
chainBackend, err := rpctest.New(netParams, nil, args, GetBtcdBinary())
chainBackend, err := rpctest.New(
netParams, nil, args, node.GetBtcdBinary(),
)
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)
}
// We want to overwrite some of the connection settings to make the
@@ -112,7 +116,8 @@ func NewBackend(miner string, netParams *chaincfg.Params) (
chainBackend.ConnectionRetryTimeout = rpctest.DefaultConnectionRetryTimeout * 2
if err := chainBackend.SetUp(false, 0); err != nil {
return nil, nil, fmt.Errorf("unable to set up btcd backend: %v", err)
return nil, nil, fmt.Errorf("unable to set up btcd backend: %v",
err)
}
bd := &BtcdBackendConfig{
@@ -141,14 +146,16 @@ func NewBackend(miner string, netParams *chaincfg.Params) (
for _, file := range files {
logFile := fmt.Sprintf("%s/%s", logDir, file.Name())
newFilename := strings.Replace(
file.Name(), "btcd.log", "output_btcd_chainbackend.log", 1,
file.Name(), "btcd.log",
"output_btcd_chainbackend.log", 1,
)
logDestination := fmt.Sprintf(
"%s/%s", GetLogDir(), newFilename,
"%s/%s", node.GetLogDir(), newFilename,
)
err := CopyFile(logDestination, logFile)
err := node.CopyFile(logDestination, logFile)
if err != nil {
errStr += fmt.Sprintf("unable to copy file: %v\n", err)
errStr += fmt.Sprintf("unable to copy file: "+
"%v\n", err)
}
}