|
@ -22,7 +22,7 @@ var Storage = function(opts) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var zeroPad = function(x, length) { |
|
|
var zeroPad = function(x, length) { |
|
|
return (Array(length).join('0') + parseInt(x)).slice(-length); |
|
|
return _.padLeft(parseInt(x), length, '0'); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var walletPrefix = function(id) { |
|
|
var walletPrefix = function(id) { |
|
@ -33,7 +33,8 @@ var opKey = function(key) { |
|
|
return key ? '!' + key : ''; |
|
|
return key ? '!' + key : ''; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var MAX_TS = Array(14).join('9'); |
|
|
var MAX_TS = _.repeat('9', 14); |
|
|
|
|
|
|
|
|
var opKeyTs = function(key) { |
|
|
var opKeyTs = function(key) { |
|
|
return key ? '!' + zeroPad(key, 14) : ''; |
|
|
return key ? '!' + zeroPad(key, 14) : ''; |
|
|
}; |
|
|
}; |
|
@ -106,16 +107,6 @@ Storage.prototype.fetchCopayerLookup = function(copayerId, cb) { |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
Storage.prototype.fetchNotification = function(walletId, notificationId, cb) { |
|
|
|
|
|
this.db.get(KEY.NOTIFICATION(walletId, notificationId), function(err, data) { |
|
|
|
|
|
if (err) { |
|
|
|
|
|
if (err.notFound) return cb(); |
|
|
|
|
|
return cb(err); |
|
|
|
|
|
} |
|
|
|
|
|
return cb(null, Notification.fromObj(data)); |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
Storage.prototype._completeTxData = function(walletId, txs, cb) { |
|
|
Storage.prototype._completeTxData = function(walletId, txs, cb) { |
|
|
var txList = [].concat(txs); |
|
|
var txList = [].concat(txs); |
|
|
this.fetchWallet(walletId, function(err, wallet) { |
|
|
this.fetchWallet(walletId, function(err, wallet) { |
|
|