chainntnfs: 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:05:01 +08:00
parent 994f4d67a1
commit 712177ee03
5 changed files with 20 additions and 30 deletions

View File

@@ -5,7 +5,6 @@ package btcdnotify
import (
"bytes"
"io/ioutil"
"testing"
"github.com/btcsuite/btcd/chaincfg/chainhash"
@@ -33,10 +32,12 @@ var (
func initHintCache(t *testing.T) *chainntnfs.HeightHintCache {
t.Helper()
tempDir, err := ioutil.TempDir("", "kek")
require.NoError(t, err, "unable to create temp dir")
db, err := channeldb.Open(tempDir)
db, err := channeldb.Open(t.TempDir())
require.NoError(t, err, "unable to create db")
t.Cleanup(func() {
require.NoError(t, db.Close())
})
testCfg := chainntnfs.CacheConfig{
QueryDisable: false,
}