add checksum on close
This commit is contained in:
parent
a8923d2a69
commit
5255d4ba31
2 changed files with 22 additions and 9 deletions
|
|
@ -460,9 +460,26 @@ Identity.prototype._cleanUp = function() {
|
|||
/**
|
||||
* @desc Closes the wallet and disconnects all services
|
||||
*/
|
||||
Identity.prototype.close = function() {
|
||||
this._cleanUp();
|
||||
this.emitAndKeepAlive('closed');
|
||||
Identity.prototype.close = function(cb) {
|
||||
var self = this;
|
||||
|
||||
function doClose() {
|
||||
self._cleanUp();
|
||||
self.emitAndKeepAlive('closed');
|
||||
if (cb) return cb();
|
||||
};
|
||||
|
||||
self.verifyChecksum(function(err, match) {
|
||||
if (!err && match) {
|
||||
self.store({
|
||||
noWallets: true,
|
||||
}, function(err) {
|
||||
return doClose();
|
||||
});
|
||||
} else {
|
||||
return doClose();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue