wtxmgr: remove unused functions
This commit is contained in:
parent
5e96a26171
commit
60a04006d6
1 changed files with 0 additions and 47 deletions
47
wtxmgr/db.go
47
wtxmgr/db.go
|
@ -1575,50 +1575,3 @@ func fetchVersion(ns walletdb.ReadBucket) (uint32, error) {
|
|||
|
||||
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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue