walletdb: minor.
This commit is contained in:
parent
f4a70df1a0
commit
cbd8447d80
@ -2671,5 +2671,5 @@ utils.isAlpha = function isAlpha(key) {
|
|||||||
if (typeof key !== 'string')
|
if (typeof key !== 'string')
|
||||||
return false;
|
return false;
|
||||||
// We allow /-~ (exclusive), 0-} (inclusive)
|
// We allow /-~ (exclusive), 0-} (inclusive)
|
||||||
return /^[\u0030-\u007d]+$/.test(key);
|
return key.length !== 0 && /^[\u0030-\u007d]+$/.test(key);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -659,6 +659,12 @@ WalletDB.prototype.has = function has(id, callback) {
|
|||||||
if (!id)
|
if (!id)
|
||||||
return callback(null, false);
|
return callback(null, false);
|
||||||
|
|
||||||
|
if (this.watchers[id])
|
||||||
|
return callback(null, true);
|
||||||
|
|
||||||
|
if (this.walletCache.has(id))
|
||||||
|
return callback(null, true);
|
||||||
|
|
||||||
this.db.has('w/' + id, callback);
|
this.db.has('w/' + id, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -883,6 +889,7 @@ WalletDB.prototype.createAccount = function createAccount(options, callback) {
|
|||||||
|
|
||||||
WalletDB.prototype.hasAccount = function hasAccount(id, account, callback) {
|
WalletDB.prototype.hasAccount = function hasAccount(id, account, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
var key;
|
||||||
|
|
||||||
if (!id)
|
if (!id)
|
||||||
return callback(null, false);
|
return callback(null, false);
|
||||||
@ -894,7 +901,12 @@ WalletDB.prototype.hasAccount = function hasAccount(id, account, callback) {
|
|||||||
if (index === -1)
|
if (index === -1)
|
||||||
return callback(null, false);
|
return callback(null, false);
|
||||||
|
|
||||||
self.db.has('a/' + id + '/' + index, callback);
|
key = id + '/' + index;
|
||||||
|
|
||||||
|
if (self.accountCache.has(key))
|
||||||
|
return callback(null, true);
|
||||||
|
|
||||||
|
self.db.has('a/' + key, callback);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1359,9 +1371,9 @@ WalletDB.prototype.createAddress = function createAddress(id, name, change, call
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
WalletDB.prototype.fill = function fill(id, tx, options, callback) {
|
WalletDB.prototype.fund = function fund(id, tx, options, callback) {
|
||||||
this.fetchWallet(id, callback, function(wallet, callback) {
|
this.fetchWallet(id, callback, function(wallet, callback) {
|
||||||
wallet.fill(tx, options, callback);
|
wallet.fund(tx, options, callback);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user