Skip to content

Commit

Permalink
Add CloseDB() call
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessio Treglia committed Oct 22, 2018
1 parent f63609e commit b32c232
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ FEATURES
basis for the validator commission model.
* [x/auth] Support account removal in the account mapper.
* [client/keys] [\#2544](https://github.com/cosmos/cosmos-sdk/issues/2544) Add `GetReadOnlyKeyBase()` to acquire read-only LevelDB databases.
* [crypto/keys] [\#2544](https://github.com/cosmos/cosmos-sdk/issues/2544) Add `CloseDB()` to release locks and close the storage backend.

* Tendermint

Expand Down
5 changes: 5 additions & 0 deletions crypto/keys/keybase.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,11 @@ func (kb dbKeybase) Update(name, oldpass string, getNewpass func() (string, erro
}
}

// CloseDB releases the lock and closes the storage backend.
func (kb dbKeybase) CloseDB() {
kb.db.Close()
}

func (kb dbKeybase) writeLocalKey(priv tmcrypto.PrivKey, name, passphrase string) Info {
// encrypt private key using passphrase
privArmor := mintkey.EncryptArmorPrivKey(priv, passphrase)
Expand Down
3 changes: 3 additions & 0 deletions crypto/keys/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ type Keybase interface {

// *only* works on locally-stored keys. Temporary method until we redo the exporting API
ExportPrivateKeyObject(name string, passphrase string) (crypto.PrivKey, error)

// Close the database
CloseDB()
}

// KeyType reflects a human-readable type for key listing.
Expand Down

0 comments on commit b32c232

Please sign in to comment.