wtxmgr: remove unused functions

This commit is contained in:
Oliver Gugger 2021-07-19 13:04:26 +02:00
parent 5e96a26171
commit 60a04006d6
No known key found for this signature in database
GPG key ID: 8E4256593F177720

View file

@ -1575,50 +1575,3 @@ func fetchVersion(ns walletdb.ReadBucket) (uint32, error) {
return byteOrder.Uint32(v), nil return byteOrder.Uint32(v), nil
} }
func scopedUpdate(db walletdb.DB, namespaceKey []byte, f func(walletdb.ReadWriteBucket) error) error {
tx, err := db.BeginReadWriteTx()
if err != nil {
str := "cannot begin update"
return storeError(ErrDatabase, str, err)
}
err = f(tx.ReadWriteBucket(namespaceKey))
if err != nil {
rollbackErr := tx.Rollback()
if rollbackErr != nil {
const desc = "rollback failed"
serr, ok := err.(Error)
if !ok {
// This really shouldn't happen.
return storeError(ErrDatabase, desc, rollbackErr)
}
serr.Desc = desc + ": " + serr.Desc
return serr
}
return err
}
err = tx.Commit()
if err != nil {
str := "commit failed"
return storeError(ErrDatabase, str, err)
}
return nil
}
func scopedView(db walletdb.DB, namespaceKey []byte, f func(walletdb.ReadBucket) error) error {
tx, err := db.BeginReadTx()
if err != nil {
str := "cannot begin view"
return storeError(ErrDatabase, str, err)
}
err = f(tx.ReadBucket(namespaceKey))
rollbackErr := tx.Rollback()
if err != nil {
return err
}
if rollbackErr != nil {
str := "cannot close view"
return storeError(ErrDatabase, str, rollbackErr)
}
return nil
}