wallet/mempool: lint. spvnode.
This commit is contained in:
parent
2fdfdd3c8a
commit
197e9f7aa9
@ -718,7 +718,7 @@ Mempool.prototype.removeUnchecked = function removeUnchecked(entry, limit) {
|
||||
// now exist on the blockchain).
|
||||
if (limit) {
|
||||
this._removeSpenders(entry);
|
||||
this.logger.debug('Evicting %s from the mempool.', tx.rhash);
|
||||
this.logger.debug('Evicting %s from the mempool.', entry.tx.rhash);
|
||||
}
|
||||
|
||||
this.untrackEntry(entry);
|
||||
@ -1485,7 +1485,7 @@ Mempool.prototype._removeSpenders = function _removeSpenders(entry) {
|
||||
|
||||
Mempool.prototype.memUsage = function memUsage(tx) {
|
||||
var mem = 0;
|
||||
var i, j, input, output;
|
||||
var i, input, output;
|
||||
|
||||
mem += 264; // tx
|
||||
mem += 80; // _hash
|
||||
|
||||
@ -198,7 +198,7 @@ SPVNode.prototype._open = function open(callback) {
|
||||
},
|
||||
function(next) {
|
||||
var i;
|
||||
self.walletdb.getAddresses(function(err, hashes) {
|
||||
self.walletdb.getAddressHashes(function(err, hashes) {
|
||||
if (err)
|
||||
return next(err);
|
||||
|
||||
|
||||
@ -1407,7 +1407,7 @@ TXDB.prototype.filterLocked = function filterLocked(coins) {
|
||||
TXDB.prototype.getLocked = function getLocked() {
|
||||
var keys = Object.keys(this.locked);
|
||||
var outpoints = [];
|
||||
var i, key, hash, index;
|
||||
var i, key, hash, index, outpoint;
|
||||
|
||||
for (i = 0; i < keys.length; i++) {
|
||||
key = keys[i];
|
||||
|
||||
@ -568,8 +568,8 @@ Wallet.prototype.getAccounts = function getAccounts(callback) {
|
||||
* @param {Function} callback - Returns [Error, Array].
|
||||
*/
|
||||
|
||||
Wallet.prototype.getAddresses = function getAddresses(callback) {
|
||||
this.db.getAddresses(this.wid, callback);
|
||||
Wallet.prototype.getAddressHashes = function getAddressHashes(callback) {
|
||||
this.db.getAddressHashes(this.wid, callback);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -724,23 +724,31 @@ Wallet.prototype.commit = function commit(callback) {
|
||||
|
||||
/**
|
||||
* Test whether the wallet possesses an address.
|
||||
* @param {Base58Address} address
|
||||
* @param {Address|Hash} address
|
||||
* @param {Function} callback - Returns [Error, Boolean].
|
||||
*/
|
||||
|
||||
Wallet.prototype.hasAddress = function hasAddress(address, callback) {
|
||||
return this.db.hasAddress(this.wid, address, callback);
|
||||
var hash = bcoin.address.getHash(address, 'hex');
|
||||
if (!hash)
|
||||
return callback(null, false);
|
||||
return this.db.hasAddress(this.wid, hash, callback);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get path by address hash.
|
||||
* @param {Hash} address
|
||||
* @param {Address|Hash} address
|
||||
* @param {Function} callback - Returns [Error, {@link Path}].
|
||||
*/
|
||||
|
||||
Wallet.prototype.getAddressPath = function getAddressPath(address, callback) {
|
||||
var self = this;
|
||||
this.db.getAddressPath(this.wid, address, function(err, path) {
|
||||
var hash = bcoin.address.getHash(address, 'hex');
|
||||
|
||||
if (!hash)
|
||||
return callback();
|
||||
|
||||
this.db.getAddressPath(this.wid, hash, function(err, path) {
|
||||
if (err)
|
||||
return callback(err);
|
||||
|
||||
@ -755,7 +763,7 @@ Wallet.prototype.getAddressPath = function getAddressPath(address, callback) {
|
||||
|
||||
/**
|
||||
* Get all wallet paths.
|
||||
* @param {Number} account
|
||||
* @param {(String|Number)?} account
|
||||
* @param {Function} callback - Returns [Error, {@link Path}].
|
||||
*/
|
||||
|
||||
@ -1052,13 +1060,14 @@ Wallet.prototype.deriveInputs = function deriveInputs(tx, callback) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieve a single keyring by address hash.
|
||||
* @param {Hash} hash
|
||||
* Retrieve a single keyring by address.
|
||||
* @param {Address|Hash} hash
|
||||
* @param {Function} callback
|
||||
*/
|
||||
|
||||
Wallet.prototype.getKeyring = function getKeyring(hash, callback) {
|
||||
Wallet.prototype.getKeyring = function getKeyring(address, callback) {
|
||||
var self = this;
|
||||
var hash = bcoin.address.getHash(address, 'hex');
|
||||
var address;
|
||||
|
||||
if (!hash)
|
||||
|
||||
@ -1017,7 +1017,7 @@ WalletDB.prototype.hasAddress = function hasAddress(wid, address, callback) {
|
||||
* @param {Function} callback
|
||||
*/
|
||||
|
||||
WalletDB.prototype.getAddresses = function getAddresses(wid, callback) {
|
||||
WalletDB.prototype.getAddressHashes = function getAddressHashes(wid, callback) {
|
||||
if (!callback) {
|
||||
callback = wid;
|
||||
wid = null;
|
||||
@ -1088,7 +1088,7 @@ WalletDB.prototype.getWallets = function getWallets(callback) {
|
||||
WalletDB.prototype.rescan = function rescan(chaindb, callback) {
|
||||
var self = this;
|
||||
|
||||
this.getAddresses(function(err, hashes) {
|
||||
this.getAddressHashes(function(err, hashes) {
|
||||
if (err)
|
||||
return callback(err);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user