From d9c9d6ed73a2e4982458809b9539f82e030023cd Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 10 Mar 2019 16:32:59 -0700 Subject: [PATCH] lntest: add new ChanBackupPath method to expose channels.backup for node --- lntest/node.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lntest/node.go b/lntest/node.go index 8698557b..26cb6cab 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.