diff --git a/lnd_test.go b/lnd_test.go index 681aa5f2..b8588cce 100644 --- a/lnd_test.go +++ b/lnd_test.go @@ -12516,7 +12516,13 @@ func TestLightningNetworkDaemon(t *testing.T) { // setting of accepting non-standard transactions on simnet to reject them. // Transactions on the lightning network should always be standard to get // better guarantees of getting included in to blocks. - args := []string{"--rejectnonstd", "--txindex"} + logDir := "./.backendlogs" + args := []string{ + "--rejectnonstd", + "--txindex", + "--debuglevel=debug", + "--logdir=" + logDir, + } handlers := &rpcclient.NotificationHandlers{ OnTxAccepted: func(hash *chainhash.Hash, amt btcutil.Amount) { lndHarness.OnTxAccepted(hash) @@ -12526,7 +12532,21 @@ func TestLightningNetworkDaemon(t *testing.T) { if err != nil { ht.Fatalf("unable to create mining node: %v", err) } - defer btcdHarness.TearDown() + defer func() { + btcdHarness.TearDown() + + // After shutting down the chain backend, we'll make a copy of + // the log file before deleting the temporary log dir. + logFile := logDir + "/" + harnessNetParams.Name + "/btcd.log" + err := lntest.CopyFile("./output_btcd_chainbackend.log", + logFile) + if err != nil { + fmt.Printf("unable to copy file: %v\n", err) + } + if err = os.RemoveAll(logDir); err != nil { + fmt.Printf("Cannot remove dir %s: %v\n", logDir, err) + } + }() // First create the network harness to gain access to its // 'OnTxAccepted' call back.