diff --git a/lntest/node.go b/lntest/node.go index 8698557b5..26cb6cabe 100644 --- a/lntest/node.go +++ b/lntest/node.go @@ -25,6 +25,7 @@ import ( "github.com/btcsuite/btcd/wire" "github.com/btcsuite/btcutil" "github.com/go-errors/errors" + "github.com/lightningnetwork/lnd/chanbackup" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/macaroons" ) @@ -142,6 +143,16 @@ func (cfg nodeConfig) DBPath() string { fmt.Sprintf("%v/channel.db", cfg.NetParams.Name)) } +func (cfg nodeConfig) ChanBackupPath() string { + return filepath.Join( + cfg.DataDir, "chain", "bitcoin", + fmt.Sprintf( + "%v/%v", cfg.NetParams.Name, + chanbackup.DefaultBackupFileName, + ), + ) +} + // genArgs generates a slice of command line arguments from the lightning node // config struct. func (cfg nodeConfig) genArgs() []string { @@ -279,6 +290,12 @@ func (hn *HarnessNode) Name() string { return hn.cfg.Name } +// ChanBackupPath returns the fielpath to the on-disk channels.backup file for +// this node. +func (hn *HarnessNode) ChanBackupPath() string { + return hn.cfg.ChanBackupPath() +} + // Start launches a new process running lnd. Additionally, the PID of the // launched process is saved in order to possibly kill the process forcibly // later.