htlcswitch: use T.TempDir to create temporary test directory

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun
2022-08-15 21:06:21 +08:00
parent 4f1e4ff87a
commit 9294b53fcc
5 changed files with 43 additions and 78 deletions

View File

@@ -3,7 +3,6 @@ package htlcswitch_test
import (
"bytes"
"fmt"
"io/ioutil"
"reflect"
"testing"
@@ -624,11 +623,7 @@ func equalIgnoreLFD(c, c2 *htlcswitch.PaymentCircuit) bool {
// will be created.
func makeCircuitDB(t *testing.T, path string) *channeldb.DB {
if path == "" {
var err error
path, err = ioutil.TempDir("", "circuitdb")
if err != nil {
t.Fatalf("unable to create temp path: %v", err)
}
path = t.TempDir()
}
db, err := channeldb.Open(path)