channeldb: Open is no longer dependant on a specific set of chain params
This commit is contained in:
6 files changed
+11
-15
No files matched your search
@@ -92,7 +92,7 @@ func makeTestDB() (*DB, func(), error) {
|
||||
}
|
||||
|
||||
// Next, create channeldb for the first time.
|
||||
cdb, err := Open(tempDirName, netParams)
|
||||
cdb, err := Open(tempDirName)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
+4
-7
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
"github.com/roasbeef/btcd/btcec"
|
||||
"github.com/roasbeef/btcd/chaincfg"
|
||||
"github.com/roasbeef/btcd/wire"
|
||||
)
|
||||
|
||||
@@ -56,13 +55,12 @@ var bufPool = &sync.Pool{
|
||||
// schedules, and reputation data.
|
||||
type DB struct {
|
||||
*bolt.DB
|
||||
netParams *chaincfg.Params
|
||||
dbPath string
|
||||
dbPath string
|
||||
}
|
||||
|
||||
// Open opens an existing channeldb. Any necessary schemas migrations due to
|
||||
// udpates will take plave as necessary.
|
||||
func Open(dbPath string, netParams *chaincfg.Params) (*DB, error) {
|
||||
func Open(dbPath string) (*DB, error) {
|
||||
path := filepath.Join(dbPath, dbName)
|
||||
|
||||
if !fileExists(path) {
|
||||
@@ -77,9 +75,8 @@ func Open(dbPath string, netParams *chaincfg.Params) (*DB, error) {
|
||||
}
|
||||
|
||||
chanDB := &DB{
|
||||
DB: bdb,
|
||||
netParams: netParams,
|
||||
dbPath: dbPath,
|
||||
DB: bdb,
|
||||
dbPath: dbPath,
|
||||
}
|
||||
|
||||
// Synchronize the version of database and apply migrations if needed.
|
||||
|
||||
@@ -18,7 +18,7 @@ func TestOpenWithCreate(t *testing.T) {
|
||||
|
||||
// Next, open thereby creating channeldb for the first time.
|
||||
dbPath := filepath.Join(tempDirName, "cdb")
|
||||
cdb, err := Open(dbPath, netParams)
|
||||
cdb, err := Open(dbPath)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to create channeldb: %v", err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user