multi: rename chan DB Open method to OpenForTesting

This commit is contained in:
Elle Mouton committed 2024-11-28 13:51:15 +02:00
1 parent 4089fbcb44
commit 439a6c7d6c
24 files changed
+101 -331

No files matched your search

+1 -19
View File
@@ -73,21 +73,6 @@ var (
rebroadcastInterval = time.Hour * 1000000
)
// makeTestDB creates a new instance of the ChannelDB for testing purposes.
func makeTestDB(t *testing.T) (*channeldb.DB, error) {
// Create channeldb for the first time.
cdb, err := channeldb.Open(t.TempDir())
if err != nil {
return nil, err
}
t.Cleanup(func() {
cdb.Close()
})
return cdb, nil
}
type mockGraphSource struct {
bestHeight uint32
@@ -734,10 +719,7 @@ func createTestCtx(t *testing.T, startHeight uint32, isChanPeer bool) (
notifier := newMockNotifier()
router := newMockRouter(startHeight)
db, err := makeTestDB(t)
if err != nil {
return nil, err
}
db := channeldb.OpenForTesting(t, t.TempDir())
waitingProofStore, err := channeldb.NewWaitingProofStore(db)
if err != nil {
+2 -11
View File
@@ -17,19 +17,10 @@ import (
func createTestMessageStore(t *testing.T) *MessageStore {
t.Helper()
db, err := channeldb.Open(t.TempDir())
if err != nil {
t.Fatalf("unable to open db: %v", err)
}
t.Cleanup(func() {
db.Close()
})
db := channeldb.OpenForTesting(t, t.TempDir())
store, err := NewMessageStore(db)
if err != nil {
t.Fatalf("unable to initialize message store: %v", err)
}
require.NoError(t, err)
return store
}