channeldb: remove unused tx argument

This commit is contained in:
Oliver Gugger 2022-09-30 14:17:12 +02:00
parent ee9d6f21bd
commit 28c8e8b6dd
No known key found for this signature in database
GPG Key ID: 8E4256593F177720
3 changed files with 9 additions and 10 deletions

View File

@ -1417,7 +1417,7 @@ func (c *ChannelStateDB) DeleteChannelOpeningState(outPoint []byte) error {
// applies migration functions to the current database and recovers the
// previous state of db if at least one error/panic appeared during migration.
func (d *DB) syncVersions(versions []mandatoryVersion) error {
meta, err := d.FetchMeta(nil)
meta, err := d.FetchMeta()
if err != nil {
if err == ErrMetaNotFound {
meta = &Meta{}

View File

@ -28,9 +28,8 @@ type Meta struct {
DbVersionNumber uint32
}
// FetchMeta fetches the meta data from boltdb and returns filled meta
// structure.
func (d *DB) FetchMeta(tx kvdb.RTx) (*Meta, error) {
// FetchMeta fetches the metadata from boltdb and returns filled meta structure.
func (d *DB) FetchMeta() (*Meta, error) {
var meta *Meta
err := kvdb.View(d, func(tx kvdb.RTx) error {

View File

@ -91,7 +91,7 @@ func TestVersionFetchPut(t *testing.T) {
t.Fatal(err)
}
meta, err := db.FetchMeta(nil)
meta, err := db.FetchMeta()
if err != nil {
t.Fatal(err)
}
@ -107,7 +107,7 @@ func TestVersionFetchPut(t *testing.T) {
t.Fatalf("update of meta failed %v", err)
}
meta, err = db.FetchMeta(nil)
meta, err = db.FetchMeta()
if err != nil {
t.Fatal(err)
}
@ -228,7 +228,7 @@ func TestMigrationWithPanic(t *testing.T) {
// Check that version of database and data wasn't changed.
afterMigrationFunc := func(d *DB) {
meta, err := d.FetchMeta(nil)
meta, err := d.FetchMeta()
if err != nil {
t.Fatal(err)
}
@ -303,7 +303,7 @@ func TestMigrationWithFatal(t *testing.T) {
// Check that version of database and initial data wasn't changed.
afterMigrationFunc := func(d *DB) {
meta, err := d.FetchMeta(nil)
meta, err := d.FetchMeta()
if err != nil {
t.Fatal(err)
}
@ -377,7 +377,7 @@ func TestMigrationWithoutErrors(t *testing.T) {
// Check that version of database and data was properly changed.
afterMigrationFunc := func(d *DB) {
meta, err := d.FetchMeta(nil)
meta, err := d.FetchMeta()
if err != nil {
t.Fatal(err)
}
@ -469,7 +469,7 @@ func TestMigrationDryRun(t *testing.T) {
// Check that version of database version is not modified.
afterMigrationFunc := func(d *DB) {
err := kvdb.View(d, func(tx kvdb.RTx) error {
meta, err := d.FetchMeta(nil)
meta, err := d.FetchMeta()
if err != nil {
t.Fatal(err)
}