refactor key handing in storage (part 1)

This commit is contained in:
Matias Alejo Garcia 2014-09-27 11:38:25 -03:00
commit 691951a86a
3 changed files with 16 additions and 15 deletions

View file

@ -873,7 +873,10 @@ Wallet.prototype.keepAlive = function() {
Wallet.prototype.store = function(cb) {
var self = this;
this.keepAlive();
this.storage.setFromObj(this.id, this.toObj(), function(err) {
var val = this.toObj();
var key = 'wallet::' + this.id + ((val.opts && val.opts.name) ? '_' + obj.opts.name : '');
this.storage.setFromObj(key, val, function(err) {
log.debug('Wallet stored');
if (cb)
cb(err);