lint: fix function names.

This commit is contained in:
Christopher Jeffrey 2017-07-30 16:49:24 -07:00
parent 55cf07a871
commit 5e73e51177
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
71 changed files with 202 additions and 159 deletions

View File

@ -1,8 +1,6 @@
{ {
"env": { "env": {
"browser": true,
"es6": true, "es6": true,
"mocha": true,
"node": true "node": true
}, },
"extends": "eslint:recommended", "extends": "eslint:recommended",

View File

@ -433,7 +433,7 @@ CLI.prototype.importKey = async function importKey() {
throw new Error('Bad key for import.'); throw new Error('Bad key for import.');
}; };
CLI.prototype.importAddress = async function importKey() { CLI.prototype.importAddress = async function importAddress() {
const address = this.config.str(0); const address = this.config.str(0);
const account = this.config.str('account'); const account = this.config.str('account');
await this.wallet.importAddress(account, address); await this.wallet.importAddress(account, address);

View File

@ -130,7 +130,7 @@ const bcoin = exports;
* @param {String} path * @param {String} path
*/ */
bcoin.define = function _require(name, path) { bcoin.define = function define(name, path) {
let cache; let cache;
bcoin.__defineGetter__(name, function() { bcoin.__defineGetter__(name, function() {
if (!cache) if (!cache)

View File

@ -96,7 +96,7 @@ util.inherits(Chain, AsyncObject);
* @returns {Promise} * @returns {Promise}
*/ */
Chain.prototype._open = async function open() { Chain.prototype._open = async function _open() {
this.logger.info('Chain is loading.'); this.logger.info('Chain is loading.');
if (this.options.checkpoints) if (this.options.checkpoints)
@ -141,7 +141,7 @@ Chain.prototype._open = async function open() {
* @returns {Promise} * @returns {Promise}
*/ */
Chain.prototype._close = function close() { Chain.prototype._close = function _close() {
return this.db.close(); return this.db.close();
}; };
@ -194,7 +194,7 @@ Chain.prototype.verifyBlock = async function verifyBlock(block) {
* @returns {Promise} * @returns {Promise}
*/ */
Chain.prototype._verifyBlock = async function verifyBlock(block) { Chain.prototype._verifyBlock = async function _verifyBlock(block) {
const flags = common.flags.DEFAULT_FLAGS & ~common.flags.VERIFY_POW; const flags = common.flags.DEFAULT_FLAGS & ~common.flags.VERIFY_POW;
return await this.verifyContext(block, this.tip, flags); return await this.verifyContext(block, this.tip, flags);
}; };
@ -1078,7 +1078,7 @@ Chain.prototype.reset = async function reset(block) {
* @returns {Promise} * @returns {Promise}
*/ */
Chain.prototype._reset = async function reset(block, silent) { Chain.prototype._reset = async function _reset(block, silent) {
const tip = await this.db.reset(block); const tip = await this.db.reset(block);
// Reset state. // Reset state.
@ -1129,7 +1129,7 @@ Chain.prototype.replay = async function replay(block) {
* @returns {Promise} * @returns {Promise}
*/ */
Chain.prototype._replay = async function replay(block, silent) { Chain.prototype._replay = async function _replay(block, silent) {
const entry = await this.db.getEntry(block); const entry = await this.db.getEntry(block);
if (!entry) if (!entry)
@ -1234,7 +1234,7 @@ Chain.prototype.add = async function add(block, flags, id) {
* @returns {Promise} * @returns {Promise}
*/ */
Chain.prototype._add = async function add(block, flags, id) { Chain.prototype._add = async function _add(block, flags, id) {
const hash = block.hash('hex'); const hash = block.hash('hex');
if (flags == null) if (flags == null)
@ -1861,7 +1861,7 @@ Chain.prototype.getLocator = async function getLocator(start) {
* @returns {Promise} * @returns {Promise}
*/ */
Chain.prototype._getLocator = async function getLocator(start) { Chain.prototype._getLocator = async function _getLocator(start) {
if (start == null) if (start == null)
start = this.tip.hash; start = this.tip.hash;

View File

@ -1159,7 +1159,7 @@ ChainDB.prototype.getTXByAddress = async function getTXByAddress(addrs) {
* @returns {Promise} - Returns {@link TXMeta}[]. * @returns {Promise} - Returns {@link TXMeta}[].
*/ */
ChainDB.prototype.getMetaByAddress = async function getTXByAddress(addrs) { ChainDB.prototype.getMetaByAddress = async function getMetaByAddress(addrs) {
if (!this.options.indexTX || !this.options.indexAddress) if (!this.options.indexTX || !this.options.indexAddress)
return []; return [];
@ -1299,7 +1299,7 @@ ChainDB.prototype.save = async function save(entry, block, view) {
* @returns {Promise} * @returns {Promise}
*/ */
ChainDB.prototype._save = async function save(entry, block, view) { ChainDB.prototype._save = async function _save(entry, block, view) {
const hash = block.hash(); const hash = block.hash();
// Hash->height index. // Hash->height index.
@ -1367,7 +1367,7 @@ ChainDB.prototype.reconnect = async function reconnect(entry, block, view) {
* @returns {Promise} * @returns {Promise}
*/ */
ChainDB.prototype._reconnect = async function reconnect(entry, block, view) { ChainDB.prototype._reconnect = async function _reconnect(entry, block, view) {
const hash = block.hash(); const hash = block.hash();
assert(!entry.isGenesis()); assert(!entry.isGenesis());
@ -1425,7 +1425,7 @@ ChainDB.prototype.disconnect = async function disconnect(entry, block) {
* @returns {Promise} - Returns {@link CoinView}. * @returns {Promise} - Returns {@link CoinView}.
*/ */
ChainDB.prototype._disconnect = async function disconnect(entry, block) { ChainDB.prototype._disconnect = async function _disconnect(entry, block) {
// Remove hash->next-block index. // Remove hash->next-block index.
this.del(layout.n(entry.prevBlock)); this.del(layout.n(entry.prevBlock));
@ -1574,7 +1574,7 @@ ChainDB.prototype.removeChains = async function removeChains() {
* @returns {Promise} * @returns {Promise}
*/ */
ChainDB.prototype._removeChain = async function removeChain(hash) { ChainDB.prototype._removeChain = async function _removeChain(hash) {
let tip = await this.getEntry(hash); let tip = await this.getEntry(hash);
if (!tip) if (!tip)
@ -2070,7 +2070,7 @@ ChainState.prototype.connect = function connect(block) {
this.tx += block.txs.length; this.tx += block.txs.length;
}; };
ChainState.prototype.disconnect = function connect(block) { ChainState.prototype.disconnect = function disconnect(block) {
this.tx -= block.txs.length; this.tx -= block.txs.length;
}; };

View File

@ -69,7 +69,7 @@ const layout = {
assert(addr.length === 40); assert(addr.length === 40);
return 'C' + addr + hex(hash) + pad32(index); return 'C' + addr + hex(hash) + pad32(index);
}, },
pp: function aa(key) { pp: function pp(key) {
assert(typeof key === 'string'); assert(typeof key === 'string');
assert(key.length === 65); assert(key.length === 65);
return key.slice(1, 65); return key.slice(1, 65);

View File

@ -124,7 +124,7 @@ const layout = {
return key; return key;
}, },
pp: function aa(key) { pp: function pp(key) {
assert(Buffer.isBuffer(key)); assert(Buffer.isBuffer(key));
assert(key.length === 33); assert(key.length === 33);
return key.toString('hex', 1, 33); return key.toString('hex', 1, 33);

View File

@ -103,7 +103,7 @@ SHA256.prototype.finish = function finish() {
* @param {Number} len * @param {Number} len
*/ */
SHA256.prototype._update = function update(data, len) { SHA256.prototype._update = function _update(data, len) {
let size = this.bytes & 0x3f; let size = this.bytes & 0x3f;
let pos = 0; let pos = 0;

View File

@ -22,7 +22,7 @@ DB.prototype.get = function get(key, options, callback) {
this.level.get(key, options, callback); this.level.get(key, options, callback);
}; };
DB.prototype.put = function get(key, value, options, callback) { DB.prototype.put = function put(key, value, options, callback) {
if (this.bufferKeys && Buffer.isBuffer(key)) if (this.bufferKeys && Buffer.isBuffer(key))
key = key.toString('hex'); key = key.toString('hex');
this.level.put(key, value, options, callback); this.level.put(key, value, options, callback);

View File

@ -108,7 +108,7 @@ LowlevelUp.prototype.open = async function open() {
* @returns {Promise} * @returns {Promise}
*/ */
LowlevelUp.prototype._open = async function open() { LowlevelUp.prototype._open = async function _open() {
if (this.loaded) if (this.loaded)
throw new Error('Database is already open.'); throw new Error('Database is already open.');
@ -150,7 +150,7 @@ LowlevelUp.prototype.close = async function close() {
* @returns {Promise} * @returns {Promise}
*/ */
LowlevelUp.prototype._close = async function close() { LowlevelUp.prototype._close = async function _close() {
if (!this.loaded) if (!this.loaded)
throw new Error('Database is already closed.'); throw new Error('Database is already closed.');

View File

@ -354,15 +354,8 @@ HTTPBase.prototype._readBody = function _readBody(req, enc, options, resolve, re
let total = 0; let total = 0;
let body = ''; let body = '';
let timer = setTimeout(() => {
timer = null;
cleanup();
reject(new Error('Request body timed out.'));
}, options.timeout);
/* eslint no-use-before-define: "off" */
const cleanup = () => { const cleanup = () => {
/* eslint-disable */
req.removeListener('data', onData); req.removeListener('data', onData);
req.removeListener('error', onError); req.removeListener('error', onError);
req.removeListener('end', onEnd); req.removeListener('end', onEnd);
@ -371,6 +364,7 @@ HTTPBase.prototype._readBody = function _readBody(req, enc, options, resolve, re
timer = null; timer = null;
clearTimeout(timer); clearTimeout(timer);
} }
/* eslint-enable */
}; };
const onData = (data) => { const onData = (data) => {
@ -401,6 +395,12 @@ HTTPBase.prototype._readBody = function _readBody(req, enc, options, resolve, re
resolve(null); resolve(null);
}; };
let timer = setTimeout(() => {
timer = null;
cleanup();
reject(new Error('Request body timed out.'));
}, options.timeout);
req.on('data', onData); req.on('data', onData);
req.on('error', onError); req.on('error', onError);
req.on('end', onEnd); req.on('end', onEnd);
@ -689,7 +689,7 @@ HTTPBase.prototype.channel = function channel(name) {
* @returns {Promise} * @returns {Promise}
*/ */
HTTPBase.prototype._open = function open() { HTTPBase.prototype._open = function _open() {
return this.listen(this.config.port, this.config.host); return this.listen(this.config.port, this.config.host);
}; };
@ -699,7 +699,7 @@ HTTPBase.prototype._open = function open() {
* @returns {Promise} * @returns {Promise}
*/ */
HTTPBase.prototype._close = function close() { HTTPBase.prototype._close = function _close() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (this.io) { if (this.io) {
this.server.once('close', resolve); this.server.once('close', resolve);

View File

@ -115,7 +115,7 @@ HTTPClient.prototype._open = async function _open() {
* @returns {Promise} * @returns {Promise}
*/ */
HTTPClient.prototype._close = function close() { HTTPClient.prototype._close = function _close() {
if (!this.socket) if (!this.socket)
return Promise.resolve(); return Promise.resolve();

View File

@ -1597,7 +1597,7 @@ RPC.prototype.generate = async function generate(args, help) {
return await this.mineBlocks(blocks, null, tries); return await this.mineBlocks(blocks, null, tries);
}; };
RPC.prototype.generateToAddress = async function _generateToAddress(args, help) { RPC.prototype.generateToAddress = async function generateToAddress(args, help) {
if (help || args.length < 2 || args.length > 3) { if (help || args.length < 2 || args.length > 3) {
throw new RPCError(errs.MISC_ERROR, throw new RPCError(errs.MISC_ERROR,
'generatetoaddress numblocks address ( maxtries )'); 'generatetoaddress numblocks address ( maxtries )');

View File

@ -104,7 +104,7 @@ util.inherits(Mempool, AsyncObject);
* @returns {Promise} * @returns {Promise}
*/ */
Mempool.prototype._open = async function open() { Mempool.prototype._open = async function _open() {
await this.chain.open(); await this.chain.open();
await this.cache.open(); await this.cache.open();
@ -152,7 +152,7 @@ Mempool.prototype._open = async function open() {
* @returns {Promise} * @returns {Promise}
*/ */
Mempool.prototype._close = async function close() { Mempool.prototype._close = async function _close() {
await this.cache.close(); await this.cache.close();
}; };
@ -184,7 +184,7 @@ Mempool.prototype.addBlock = async function addBlock(block, txs) {
* @returns {Promise} * @returns {Promise}
*/ */
Mempool.prototype._addBlock = async function addBlock(block, txs) { Mempool.prototype._addBlock = async function _addBlock(block, txs) {
if (this.map.size === 0) { if (this.map.size === 0) {
this.tip = block.hash; this.tip = block.hash;
return; return;
@ -262,7 +262,7 @@ Mempool.prototype.removeBlock = async function removeBlock(block, txs) {
* @returns {Promise} * @returns {Promise}
*/ */
Mempool.prototype._removeBlock = async function removeBlock(block, txs) { Mempool.prototype._removeBlock = async function _removeBlock(block, txs) {
if (this.map.size === 0) { if (this.map.size === 0) {
this.tip = block.prevBlock; this.tip = block.prevBlock;
return; return;
@ -324,7 +324,7 @@ Mempool.prototype.reset = async function reset() {
* @private * @private
*/ */
Mempool.prototype._reset = async function reset() { Mempool.prototype._reset = async function _reset() {
this.logger.info('Mempool reset (%d txs removed).', this.map.size); this.logger.info('Mempool reset (%d txs removed).', this.map.size);
this.size = 0; this.size = 0;
@ -1165,7 +1165,7 @@ Mempool.prototype.updateAncestors = function updateAncestors(entry, map) {
* @returns {Number} * @returns {Number}
*/ */
Mempool.prototype._countAncestors = function countAncestors(entry, set, child, map) { Mempool.prototype._countAncestors = function _countAncestors(entry, set, child, map) {
const tx = entry.tx; const tx = entry.tx;
for (const input of tx.inputs) { for (const input of tx.inputs) {
@ -1214,7 +1214,7 @@ Mempool.prototype.countDescendants = function countDescendants(entry) {
* @returns {Number} * @returns {Number}
*/ */
Mempool.prototype._countDescendants = function countDescendants(entry, set) { Mempool.prototype._countDescendants = function _countDescendants(entry, set) {
const tx = entry.tx; const tx = entry.tx;
const hash = tx.hash('hex'); const hash = tx.hash('hex');
@ -1256,7 +1256,7 @@ Mempool.prototype.getAncestors = function getAncestors(entry) {
* @returns {MempoolEntry[]} * @returns {MempoolEntry[]}
*/ */
Mempool.prototype._getAncestors = function getAncestors(entry, entries, set) { Mempool.prototype._getAncestors = function _getAncestors(entry, entries, set) {
const tx = entry.tx; const tx = entry.tx;
for (const input of tx.inputs) { for (const input of tx.inputs) {
@ -1296,7 +1296,7 @@ Mempool.prototype.getDescendants = function getDescendants(entry) {
* @returns {MempoolEntry[]} * @returns {MempoolEntry[]}
*/ */
Mempool.prototype._getDescendants = function getDescendants(entry, entries, set) { Mempool.prototype._getDescendants = function _getDescendants(entry, entries, set) {
const tx = entry.tx; const tx = entry.tx;
const hash = tx.hash('hex'); const hash = tx.hash('hex');

View File

@ -76,7 +76,7 @@ CPUMiner.prototype._init = function _init() {
* @returns {Promise} * @returns {Promise}
*/ */
CPUMiner.prototype._open = async function open() { CPUMiner.prototype._open = async function _open() {
}; };
/** /**
@ -86,7 +86,7 @@ CPUMiner.prototype._open = async function open() {
* @returns {Promise} * @returns {Promise}
*/ */
CPUMiner.prototype._close = async function close() { CPUMiner.prototype._close = async function _close() {
await this.stop(); await this.stop();
}; };
@ -107,7 +107,7 @@ CPUMiner.prototype.start = function start() {
* @returns {Promise} * @returns {Promise}
*/ */
CPUMiner.prototype._start = async function start() { CPUMiner.prototype._start = async function _start() {
assert(!this.running, 'Miner is already running.'); assert(!this.running, 'Miner is already running.');
this.running = true; this.running = true;

View File

@ -68,7 +68,7 @@ Miner.prototype.init = function init() {
* @returns {Promise} * @returns {Promise}
*/ */
Miner.prototype._open = async function open() { Miner.prototype._open = async function _open() {
await this.chain.open(); await this.chain.open();
if (this.mempool) if (this.mempool)
@ -90,7 +90,7 @@ Miner.prototype._open = async function open() {
* @returns {Promise} * @returns {Promise}
*/ */
Miner.prototype._close = async function close() { Miner.prototype._close = async function _close() {
await this.cpu.close(); await this.cpu.close();
}; };
@ -120,7 +120,7 @@ Miner.prototype.createBlock = async function createBlock(tip, address) {
* @returns {Promise} - Returns {@link BlockTemplate}. * @returns {Promise} - Returns {@link BlockTemplate}.
*/ */
Miner.prototype._createBlock = async function createBlock(tip, address) { Miner.prototype._createBlock = async function _createBlock(tip, address) {
let version = this.options.version; let version = this.options.version;
if (!tip) if (!tip)

View File

@ -407,7 +407,7 @@ BIP150.prototype.wait = function wait(timeout) {
* @param {Function} reject * @param {Function} reject
*/ */
BIP150.prototype._wait = function wait(timeout, resolve, reject) { BIP150.prototype._wait = function _wait(timeout, resolve, reject) {
assert(!this.auth, 'Cannot wait for init after handshake.'); assert(!this.auth, 'Cannot wait for init after handshake.');
this.job = co.job(resolve, reject); this.job = co.job(resolve, reject);

View File

@ -527,7 +527,7 @@ BIP151.prototype.wait = function wait(timeout) {
* @param {Function} reject * @param {Function} reject
*/ */
BIP151.prototype._wait = function wait(timeout, resolve, reject) { BIP151.prototype._wait = function _wait(timeout, resolve, reject) {
assert(!this.handshake, 'Cannot wait for init after handshake.'); assert(!this.handshake, 'Cannot wait for init after handshake.');
this.job = co.job(resolve, reject); this.job = co.job(resolve, reject);

View File

@ -133,7 +133,7 @@ HostList.scores = {
* @private * @private
*/ */
HostList.prototype._init = function init() { HostList.prototype._init = function _init() {
const options = this.options; const options = this.options;
const scores = HostList.scores; const scores = HostList.scores;
const hosts = IP.getPublic(); const hosts = IP.getPublic();

View File

@ -262,7 +262,7 @@ Peer.fromOptions = function fromOptions(options) {
* @private * @private
*/ */
Peer.prototype._init = function init() { Peer.prototype._init = function _init() {
this.parser.on('packet', async (packet) => { this.parser.on('packet', async (packet) => {
try { try {
await this.readPacket(packet); await this.readPacket(packet);
@ -484,7 +484,7 @@ Peer.prototype.open = async function open() {
* @returns {Promise} * @returns {Promise}
*/ */
Peer.prototype._open = async function open() { Peer.prototype._open = async function _open() {
this.opened = true; this.opened = true;
// Connect to peer. // Connect to peer.
@ -515,13 +515,12 @@ Peer.prototype.initConnect = function initConnect() {
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
/* eslint no-use-before-define: "off" */
const cleanup = () => { const cleanup = () => {
if (this.connectTimeout != null) { if (this.connectTimeout != null) {
clearTimeout(this.connectTimeout); clearTimeout(this.connectTimeout);
this.connectTimeout = null; this.connectTimeout = null;
} }
// eslint-disable-next-line no-use-before-define
this.socket.removeListener('error', onError); this.socket.removeListener('error', onError);
}; };
@ -2018,7 +2017,7 @@ Peer.prototype.sendGetHeaders = function sendGetHeaders(locator, stop) {
* @param {Hash?} stop - Hash to stop at. * @param {Hash?} stop - Hash to stop at.
*/ */
Peer.prototype.sendGetBlocks = function getBlocks(locator, stop) { Peer.prototype.sendGetBlocks = function sendGetBlocks(locator, stop) {
const packet = new packets.GetBlocksPacket(locator, stop); const packet = new packets.GetBlocksPacket(locator, stop);
let hash = null; let hash = null;

View File

@ -271,7 +271,7 @@ Pool.prototype.resetChain = function resetChain() {
* @returns {Promise} * @returns {Promise}
*/ */
Pool.prototype._close = async function close() { Pool.prototype._close = async function _close() {
await this.disconnect(); await this.disconnect();
}; };
@ -296,7 +296,7 @@ Pool.prototype.connect = async function connect() {
* @returns {Promise} * @returns {Promise}
*/ */
Pool.prototype._connect = async function connect() { Pool.prototype._connect = async function _connect() {
assert(this.loaded, 'Pool is not loaded.'); assert(this.loaded, 'Pool is not loaded.');
if (this.connected) if (this.connected)
@ -339,7 +339,7 @@ Pool.prototype.disconnect = async function disconnect() {
* @returns {Promise} * @returns {Promise}
*/ */
Pool.prototype._disconnect = async function disconnect() { Pool.prototype._disconnect = async function _disconnect() {
assert(this.loaded, 'Pool is not loaded.'); assert(this.loaded, 'Pool is not loaded.');
if (!this.connected) if (!this.connected)
@ -1622,7 +1622,7 @@ Pool.prototype.handleInv = async function handleInv(peer, packet) {
* @param {InvPacket} packet * @param {InvPacket} packet
*/ */
Pool.prototype._handleInv = async function handleInv(peer, packet) { Pool.prototype._handleInv = async function _handleInv(peer, packet) {
const items = packet.items; const items = packet.items;
if (items.length > 50000) { if (items.length > 50000) {
@ -2075,7 +2075,7 @@ Pool.prototype.handleHeaders = async function handleHeaders(peer, packet) {
* @returns {Promise} * @returns {Promise}
*/ */
Pool.prototype._handleHeaders = async function handleHeaders(peer, packet) { Pool.prototype._handleHeaders = async function _handleHeaders(peer, packet) {
const headers = packet.items; const headers = packet.items;
if (!this.checkpoints) if (!this.checkpoints)
@ -2244,7 +2244,7 @@ Pool.prototype.addBlock = async function addBlock(peer, block, flags) {
* @returns {Promise} * @returns {Promise}
*/ */
Pool.prototype._addBlock = async function addBlock(peer, block, flags) { Pool.prototype._addBlock = async function _addBlock(peer, block, flags) {
if (!this.syncing) if (!this.syncing)
return; return;
@ -2476,7 +2476,7 @@ Pool.prototype.handleTX = async function handleTX(peer, packet) {
* @returns {Promise} * @returns {Promise}
*/ */
Pool.prototype._handleTX = async function handleTX(peer, packet) { Pool.prototype._handleTX = async function _handleTX(peer, packet) {
const tx = packet.tx; const tx = packet.tx;
const hash = tx.hash('hex'); const hash = tx.hash('hex');
const flags = chainCommon.flags.VERIFY_NONE; const flags = chainCommon.flags.VERIFY_NONE;
@ -2673,7 +2673,7 @@ Pool.prototype.handleMerkleBlock = async function handleMerkleBlock(peer, packet
* @param {MerkleBlockPacket} block * @param {MerkleBlockPacket} block
*/ */
Pool.prototype._handleMerkleBlock = async function handleMerkleBlock(peer, packet) { Pool.prototype._handleMerkleBlock = async function _handleMerkleBlock(peer, packet) {
if (!this.syncing) if (!this.syncing)
return; return;
@ -4048,7 +4048,7 @@ PoolOptions.prototype.getRate = function getRate(hash) {
* @returns {net.Socket} * @returns {net.Socket}
*/ */
PoolOptions.prototype._createSocket = function createSocket(port, host) { PoolOptions.prototype._createSocket = function _createSocket(port, host) {
return tcp.createSocket(port, host, this.proxy); return tcp.createSocket(port, host, this.proxy);
}; };
@ -4059,7 +4059,7 @@ PoolOptions.prototype._createSocket = function createSocket(port, host) {
* @returns {String[]} * @returns {String[]}
*/ */
PoolOptions.prototype._resolve = function resolve(name) { PoolOptions.prototype._resolve = function _resolve(name) {
if (this.onion) if (this.onion)
return dns.lookup(name, this.proxy); return dns.lookup(name, this.proxy);

View File

@ -151,7 +151,7 @@ UPNP.prototype.discover = async function discover() {
* @returns {Promise} Location string. * @returns {Promise} Location string.
*/ */
UPNP.prototype._discover = async function discover() { UPNP.prototype._discover = async function _discover() {
const socket = dgram.createSocket('udp4'); const socket = dgram.createSocket('udp4');
socket.on('error', (err) => { socket.on('error', (err) => {

View File

@ -217,7 +217,7 @@ FullNode.prototype._init = function _init() {
* @returns {Promise} * @returns {Promise}
*/ */
FullNode.prototype._open = async function open() { FullNode.prototype._open = async function _open() {
await this.chain.open(); await this.chain.open();
await this.mempool.open(); await this.mempool.open();
await this.miner.open(); await this.miner.open();
@ -237,7 +237,7 @@ FullNode.prototype._open = async function open() {
* @returns {Promise} * @returns {Promise}
*/ */
FullNode.prototype._close = async function close() { FullNode.prototype._close = async function _close() {
if (this.http) if (this.http)
await this.http.close(); await this.http.close();
@ -425,7 +425,7 @@ FullNode.prototype.getCoinsByAddress = async function getCoinsByAddress(addrs) {
* @returns {Promise} - Returns {@link TXMeta}[]. * @returns {Promise} - Returns {@link TXMeta}[].
*/ */
FullNode.prototype.getMetaByAddress = async function getTXByAddress(addrs) { FullNode.prototype.getMetaByAddress = async function getMetaByAddress(addrs) {
const mempool = this.mempool.getMetaByAddress(addrs); const mempool = this.mempool.getMetaByAddress(addrs);
const chain = await this.chain.db.getMetaByAddress(addrs); const chain = await this.chain.db.getMetaByAddress(addrs);
return chain.concat(mempool); return chain.concat(mempool);

View File

@ -175,7 +175,7 @@ Logger.prototype.open = async function open() {
* @returns {Promise} * @returns {Promise}
*/ */
Logger.prototype._open = async function open() { Logger.prototype._open = async function _open() {
if (!this.filename) { if (!this.filename) {
this.closed = false; this.closed = false;
return; return;
@ -220,7 +220,7 @@ Logger.prototype.close = async function close() {
* @returns {Promise} * @returns {Promise}
*/ */
Logger.prototype._close = async function close() { Logger.prototype._close = async function _close() {
if (this.timer != null) { if (this.timer != null) {
co.clearTimeout(this.timer); co.clearTimeout(this.timer);
this.timer = null; this.timer = null;
@ -325,7 +325,7 @@ Logger.prototype.reopen = async function reopen() {
* @returns {Promise} * @returns {Promise}
*/ */
Logger.prototype._reopen = async function reopen() { Logger.prototype._reopen = async function _reopen() {
if (this.stream) if (this.stream)
return; return;
@ -838,10 +838,15 @@ Logger.global = new Logger();
function openStream(filename) { function openStream(filename) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
/* eslint no-use-before-define: "off" */
const stream = fs.createWriteStream(filename, { flags: 'a' }); const stream = fs.createWriteStream(filename, { flags: 'a' });
const cleanup = () => {
/* eslint-disable */
stream.removeListener('error', onError);
stream.removeListener('open', onOpen);
/* eslint-enable */
};
const onError = (err) => { const onError = (err) => {
try { try {
stream.close(); stream.close();
@ -857,11 +862,6 @@ function openStream(filename) {
resolve(stream); resolve(stream);
}; };
const cleanup = () => {
stream.removeListener('error', onError);
stream.removeListener('open', onOpen);
};
stream.once('error', onError); stream.once('error', onError);
stream.once('open', onOpen); stream.once('open', onOpen);
}); });
@ -869,7 +869,12 @@ function openStream(filename) {
function closeStream(stream) { function closeStream(stream) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
/* eslint no-use-before-define: "off" */ const cleanup = () => {
/* eslint-disable */
stream.removeListener('error', onError);
stream.removeListener('close', onClose);
/* eslint-enable */
};
const onError = (err) => { const onError = (err) => {
cleanup(); cleanup();
@ -881,11 +886,6 @@ function closeStream(stream) {
resolve(stream); resolve(stream);
}; };
const cleanup = () => {
stream.removeListener('error', onError);
stream.removeListener('close', onClose);
};
stream.removeAllListeners('error'); stream.removeAllListeners('error');
stream.removeAllListeners('close'); stream.removeAllListeners('close');
stream.once('error', onError); stream.once('error', onError);

View File

@ -161,7 +161,7 @@ SPVNode.prototype._init = function _init() {
* @returns {Promise} * @returns {Promise}
*/ */
SPVNode.prototype._open = async function open(callback) { SPVNode.prototype._open = async function _open(callback) {
await this.chain.open(); await this.chain.open();
await this.pool.open(); await this.pool.open();
@ -179,7 +179,7 @@ SPVNode.prototype._open = async function open(callback) {
* @returns {Promise} * @returns {Promise}
*/ */
SPVNode.prototype._close = async function close() { SPVNode.prototype._close = async function _close() {
if (this.http) if (this.http)
await this.http.close(); await this.http.close();

View File

@ -115,7 +115,7 @@ AbstractBlock.prototype.isMemory = function isMemory() {
* Clear any cached values (abstract). * Clear any cached values (abstract).
*/ */
AbstractBlock.prototype._refresh = function refresh() { AbstractBlock.prototype._refresh = function _refresh() {
this._hash = null; this._hash = null;
this._hhash = null; this._hhash = null;
}; };

View File

@ -496,7 +496,7 @@ KeyRing.prototype.getScriptHash = function getScriptHash(enc) {
* @returns {Buffer} * @returns {Buffer}
*/ */
KeyRing.prototype.getScriptHash160 = function getScriptHash256(enc) { KeyRing.prototype.getScriptHash160 = function getScriptHash160(enc) {
if (!this.script) if (!this.script)
return null; return null;

View File

@ -1001,7 +1001,7 @@ TX.prototype.getOutputValue = function getOutputValue() {
* @returns {Array} [addrs, table] * @returns {Array} [addrs, table]
*/ */
TX.prototype._getInputAddresses = function getInputAddresses(view) { TX.prototype._getInputAddresses = function _getInputAddresses(view) {
const table = Object.create(null); const table = Object.create(null);
const addrs = []; const addrs = [];
@ -1032,7 +1032,7 @@ TX.prototype._getInputAddresses = function getInputAddresses(view) {
* @returns {Array} [addrs, table] * @returns {Array} [addrs, table]
*/ */
TX.prototype._getOutputAddresses = function getOutputAddresses() { TX.prototype._getOutputAddresses = function _getOutputAddresses() {
const table = Object.create(null); const table = Object.create(null);
const addrs = []; const addrs = [];
@ -1060,7 +1060,7 @@ TX.prototype._getOutputAddresses = function getOutputAddresses() {
* @returns {Array} [addrs, table] * @returns {Array} [addrs, table]
*/ */
TX.prototype._getAddresses = function getAddresses(view) { TX.prototype._getAddresses = function _getAddresses(view) {
const [addrs, table] = this._getInputAddresses(view); const [addrs, table] = this._getInputAddresses(view);
const output = this.getOutputAddresses(); const output = this.getOutputAddresses();

View File

@ -2376,7 +2376,7 @@ Script.prototype.shift = function shift() {
* @returns {Buffer} * @returns {Buffer}
*/ */
Script.prototype.pop = function push(data) { Script.prototype.pop = function pop(data) {
const op = this.code.pop(); const op = this.code.pop();
if (!op) if (!op)

View File

@ -87,22 +87,22 @@ ScriptNum.prototype.ushrn = function ushrn(value) {
return this.clone().iushrn(value); return this.clone().iushrn(value);
}; };
ScriptNum.prototype.iaddn = function addn(value) { ScriptNum.prototype.iaddn = function iaddn(value) {
this.value += value; this.value += value;
return this; return this;
}; };
ScriptNum.prototype.isubn = function subn(value) { ScriptNum.prototype.isubn = function isubn(value) {
this.value -= value; this.value -= value;
return this; return this;
}; };
ScriptNum.prototype.imuln = function muln(value) { ScriptNum.prototype.imuln = function imuln(value) {
this.value *= value; this.value *= value;
return this; return this;
}; };
ScriptNum.prototype.idivn = function divn(value) { ScriptNum.prototype.idivn = function idivn(value) {
this.value = Math.floor(this.value / value); this.value = Math.floor(this.value / value);
return this; return this;
}; };

View File

@ -434,7 +434,7 @@ Witness.prototype.shift = function shift() {
* @returns {Buffer} * @returns {Buffer}
*/ */
Witness.prototype.pop = function push(data) { Witness.prototype.pop = function pop(data) {
return this.items.pop(); return this.items.pop();
}; };

View File

@ -58,7 +58,7 @@ AsyncObject.prototype.open = async function open() {
* @returns {Promise} * @returns {Promise}
*/ */
AsyncObject.prototype.__open = async function open() { AsyncObject.prototype.__open = async function __open() {
if (this.loaded) if (this.loaded)
return; return;
@ -102,7 +102,7 @@ AsyncObject.prototype.close = async function close() {
* @returns {Promise} * @returns {Promise}
*/ */
AsyncObject.prototype.__close = async function close() { AsyncObject.prototype.__close = async function __close() {
if (!this.loaded) if (!this.loaded)
return; return;

View File

@ -21,8 +21,6 @@ const assert = require('assert');
function exec(gen) { function exec(gen) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
/* eslint no-use-before-define: "off" */
const step = (value, rejection) => { const step = (value, rejection) => {
let next; let next;
@ -46,6 +44,7 @@ function exec(gen) {
return; return;
} }
// eslint-disable-next-line no-use-before-define
next.value.then(succeed, fail); next.value.then(succeed, fail);
}; };

View File

@ -491,7 +491,7 @@ BitReader.prototype.readBits = function readBits(count) {
return num; return num;
}; };
BitReader.prototype.readBits64 = function readBits(count) { BitReader.prototype.readBits64 = function readBits64(count) {
assert(count >= 0); assert(count >= 0);
assert(count <= 64); assert(count <= 64);

View File

@ -969,7 +969,7 @@ IP.isEqual = function isEqual(a, b) {
* @returns {String} * @returns {String}
*/ */
IP.getInterfaces = function _getInterfaces(name, family) { IP.getInterfaces = function getInterfaces(name, family) {
const interfaces = os.networkInterfaces(); const interfaces = os.networkInterfaces();
const result = []; const result = [];

View File

@ -170,7 +170,7 @@ LRU.prototype.get = function get(key) {
* @returns {Boolean} * @returns {Boolean}
*/ */
LRU.prototype.has = function get(key) { LRU.prototype.has = function has(key) {
if (this.capacity === 0) if (this.capacity === 0)
return false; return false;
return this.map.has(key + ''); return this.map.has(key + '');
@ -209,7 +209,7 @@ LRU.prototype.remove = function remove(key) {
* @param {LRUItem} * @param {LRUItem}
*/ */
LRU.prototype._prependList = function prependList(item) { LRU.prototype._prependList = function _prependList(item) {
this._insertList(null, item); this._insertList(null, item);
}; };
@ -219,7 +219,7 @@ LRU.prototype._prependList = function prependList(item) {
* @param {LRUItem} * @param {LRUItem}
*/ */
LRU.prototype._appendList = function appendList(item) { LRU.prototype._appendList = function _appendList(item) {
this._insertList(this.tail, item); this._insertList(this.tail, item);
}; };
@ -230,7 +230,7 @@ LRU.prototype._appendList = function appendList(item) {
* @param {LRUItem} item * @param {LRUItem} item
*/ */
LRU.prototype._insertList = function insertList(ref, item) { LRU.prototype._insertList = function _insertList(ref, item) {
assert(!item.next); assert(!item.next);
assert(!item.prev); assert(!item.prev);
@ -260,7 +260,7 @@ LRU.prototype._insertList = function insertList(ref, item) {
* @param {LRUItem} * @param {LRUItem}
*/ */
LRU.prototype._removeList = function removeList(item) { LRU.prototype._removeList = function _removeList(item) {
if (item.prev) if (item.prev)
item.prev.next = item.next; item.prev.next = item.next;

View File

@ -101,13 +101,12 @@ BufferReader.prototype.start = function start() {
* @throws on empty stack. * @throws on empty stack.
*/ */
BufferReader.prototype.end = function _end() { BufferReader.prototype.end = function end() {
assert(this.stack.length > 0); assert(this.stack.length > 0);
const start = this.stack.pop(); const start = this.stack.pop();
const end = this.offset;
return end - start; return this.offset - start;
}; };
/** /**

View File

@ -762,7 +762,7 @@ util.isUpperCase = function isUpperCase(str) {
* @returns {Boolean} * @returns {Boolean}
*/ */
util.startsWith = function startsWiths(str, prefix) { util.startsWith = function startsWith(str, prefix) {
return str.startsWith(prefix); return str.startsWith(prefix);
}; };

View File

@ -141,7 +141,7 @@ WalletClient.prototype._open = async function _open() {
* @returns {Promise} * @returns {Promise}
*/ */
WalletClient.prototype._close = function close() { WalletClient.prototype._close = function _close() {
if (!this.socket) if (!this.socket)
return Promise.resolve(); return Promise.resolve();

View File

@ -67,7 +67,7 @@ layouts.walletdb = {
return 'n' + pad32(wid) + pad32(index); return 'n' + pad32(wid) + pad32(index);
}, },
R: 'R', R: 'R',
h: function c(height) { h: function h(height) {
return 'h' + pad32(height); return 'h' + pad32(height);
}, },
b: function b(height) { b: function b(height) {
@ -92,7 +92,7 @@ layouts.txdb = {
assert(typeof key === 'string'); assert(typeof key === 'string');
return 't' + pad32(wid) + key; return 't' + pad32(wid) + key;
}, },
pre: function prefix(key) { pre: function pre(key) {
assert(typeof key === 'string'); assert(typeof key === 'string');
return +key.slice(1, 11); return +key.slice(1, 11);
}, },

View File

@ -195,7 +195,7 @@ layouts.txdb = {
key.copy(out, 5); key.copy(out, 5);
return out; return out;
}, },
pre: function prefix(key) { pre: function pre(key) {
assert(Buffer.isBuffer(key)); assert(Buffer.isBuffer(key));
assert(key.length >= 5); assert(key.length >= 5);
return key.readUInt32BE(1, true); return key.readUInt32BE(1, true);

View File

@ -325,7 +325,7 @@ MasterKey.prototype.lock = async function _lock() {
* the timer if there is one. * the timer if there is one.
*/ */
MasterKey.prototype._lock = function lock() { MasterKey.prototype._lock = function _lock() {
if (!this.encrypted) { if (!this.encrypted) {
assert(this.timer == null); assert(this.timer == null);
assert(this.key); assert(this.key);
@ -376,7 +376,7 @@ MasterKey.prototype.decrypt = async function decrypt(passphrase, clean) {
* @returns {Promise} * @returns {Promise}
*/ */
MasterKey.prototype._decrypt = async function decrypt(passphrase, clean) { MasterKey.prototype._decrypt = async function _decrypt(passphrase, clean) {
if (!this.encrypted) if (!this.encrypted)
throw new Error('Master key is not encrypted.'); throw new Error('Master key is not encrypted.');
@ -423,7 +423,7 @@ MasterKey.prototype.encrypt = async function encrypt(passphrase, clean) {
* @returns {Promise} * @returns {Promise}
*/ */
MasterKey.prototype._encrypt = async function encrypt(passphrase, clean) { MasterKey.prototype._encrypt = async function _encrypt(passphrase, clean) {
if (this.encrypted) if (this.encrypted)
throw new Error('Master key is already encrypted.'); throw new Error('Master key is already encrypted.');

View File

@ -37,7 +37,7 @@ util.inherits(NodeClient, AsyncObject);
* @returns {Promise} * @returns {Promise}
*/ */
NodeClient.prototype._init = function init() { NodeClient.prototype._init = function _init() {
this.node.on('connect', (entry, block) => { this.node.on('connect', (entry, block) => {
if (!this.listen) if (!this.listen)
return; return;
@ -72,7 +72,7 @@ NodeClient.prototype._init = function init() {
* @returns {Promise} * @returns {Promise}
*/ */
NodeClient.prototype._open = function open(options) { NodeClient.prototype._open = function _open(options) {
this.listen = true; this.listen = true;
return Promise.resolve(); return Promise.resolve();
}; };
@ -82,7 +82,7 @@ NodeClient.prototype._open = function open(options) {
* @returns {Promise} * @returns {Promise}
*/ */
NodeClient.prototype._close = function close() { NodeClient.prototype._close = function _close() {
this.listen = false; this.listen = false;
return Promise.resolve(); return Promise.resolve();
}; };

View File

@ -216,12 +216,12 @@ RPC.prototype.addWitnessAddress = async function addWitnessAddress(args, help) {
}; };
RPC.prototype.backupWallet = async function backupWallet(args, help) { RPC.prototype.backupWallet = async function backupWallet(args, help) {
if (help || args.length !== 1 || !dest)
throw new RPCError(errs.MISC_ERROR, 'backupwallet "destination"');
const valid = new Validator([args]); const valid = new Validator([args]);
const dest = valid.str(0); const dest = valid.str(0);
if (help || args.length !== 1 || !dest)
throw new RPCError(errs.MISC_ERROR, 'backupwallet "destination"');
await this.wdb.backup(dest); await this.wdb.backup(dest);
return null; return null;

View File

@ -734,7 +734,7 @@ TXDB.prototype.add = async function add(tx, block) {
* @returns {Promise} * @returns {Promise}
*/ */
TXDB.prototype._add = async function add(tx, block) { TXDB.prototype._add = async function _add(tx, block) {
const hash = tx.hash('hex'); const hash = tx.hash('hex');
const existing = await this.getTX(hash); const existing = await this.getTX(hash);
@ -1011,7 +1011,7 @@ TXDB.prototype.confirm = async function confirm(hash, block) {
* @returns {Promise} * @returns {Promise}
*/ */
TXDB.prototype._confirm = async function confirm(wtx, block) { TXDB.prototype._confirm = async function _confirm(wtx, block) {
const tx = wtx.tx; const tx = wtx.tx;
const hash = wtx.hash; const hash = wtx.hash;
const height = block.height; const height = block.height;
@ -1333,7 +1333,7 @@ TXDB.prototype.unconfirm = async function unconfirm(hash) {
* @returns {Promise} * @returns {Promise}
*/ */
TXDB.prototype._unconfirm = async function unconfirm(hash) { TXDB.prototype._unconfirm = async function _unconfirm(hash) {
const wtx = await this.getTX(hash); const wtx = await this.getTX(hash);
if (!wtx) if (!wtx)
@ -1650,7 +1650,7 @@ TXDB.prototype.getLocked = function getLocked() {
* @returns {Promise} - Returns {@link Hash}[]. * @returns {Promise} - Returns {@link Hash}[].
*/ */
TXDB.prototype.getAccountHistoryHashes = function getHistoryHashes(account) { TXDB.prototype.getAccountHistoryHashes = function getAccountHistoryHashes(account) {
return this.keys({ return this.keys({
gte: layout.T(account, encoding.NULL_HASH), gte: layout.T(account, encoding.NULL_HASH),
lte: layout.T(account, encoding.HIGH_HASH), lte: layout.T(account, encoding.HIGH_HASH),

View File

@ -274,7 +274,7 @@ Wallet.prototype.addSharedKey = async function addSharedKey(acct, key) {
* @returns {Promise} * @returns {Promise}
*/ */
Wallet.prototype._addSharedKey = async function addSharedKey(acct, key) { Wallet.prototype._addSharedKey = async function _addSharedKey(acct, key) {
if (!key) { if (!key) {
key = acct; key = acct;
acct = null; acct = null;
@ -327,7 +327,7 @@ Wallet.prototype.removeSharedKey = async function removeSharedKey(acct, key) {
* @returns {Promise} * @returns {Promise}
*/ */
Wallet.prototype._removeSharedKey = async function removeSharedKey(acct, key) { Wallet.prototype._removeSharedKey = async function _removeSharedKey(acct, key) {
if (!key) { if (!key) {
key = acct; key = acct;
acct = null; acct = null;
@ -398,7 +398,7 @@ Wallet.prototype.encrypt = async function encrypt(passphrase) {
* @returns {Promise} * @returns {Promise}
*/ */
Wallet.prototype._encrypt = async function encrypt(passphrase) { Wallet.prototype._encrypt = async function _encrypt(passphrase) {
const key = await this.master.encrypt(passphrase, true); const key = await this.master.encrypt(passphrase, true);
this.start(); this.start();
@ -440,7 +440,7 @@ Wallet.prototype.decrypt = async function decrypt(passphrase) {
* @returns {Promise} * @returns {Promise}
*/ */
Wallet.prototype._decrypt = async function decrypt(passphrase) { Wallet.prototype._decrypt = async function _decrypt(passphrase) {
const key = await this.master.decrypt(passphrase, true); const key = await this.master.decrypt(passphrase, true);
this.start(); this.start();
@ -482,7 +482,7 @@ Wallet.prototype.retoken = async function retoken(passphrase) {
* @returns {Promise} * @returns {Promise}
*/ */
Wallet.prototype._retoken = async function retoken(passphrase) { Wallet.prototype._retoken = async function _retoken(passphrase) {
await this.unlock(passphrase); await this.unlock(passphrase);
this.tokenDepth++; this.tokenDepth++;
@ -667,7 +667,7 @@ Wallet.prototype.createAccount = async function createAccount(options, passphras
* @returns {Promise} - Returns {@link Account}. * @returns {Promise} - Returns {@link Account}.
*/ */
Wallet.prototype._createAccount = async function createAccount(options, passphrase) { Wallet.prototype._createAccount = async function _createAccount(options, passphrase) {
let name = options.name; let name = options.name;
if (!name) if (!name)
@ -815,7 +815,7 @@ Wallet.prototype.getAccount = async function getAccount(acct) {
* @returns {Promise} - Returns {@link Account}. * @returns {Promise} - Returns {@link Account}.
*/ */
Wallet.prototype._getAccount = async function getAccount(index) { Wallet.prototype._getAccount = async function _getAccount(index) {
const cache = this.accountCache.get(index); const cache = this.accountCache.get(index);
if (cache) if (cache)
@ -958,7 +958,7 @@ Wallet.prototype.createKey = async function createKey(acct, branch) {
* @returns {Promise} - Returns {@link WalletKey}. * @returns {Promise} - Returns {@link WalletKey}.
*/ */
Wallet.prototype._createKey = async function createKey(acct, branch) { Wallet.prototype._createKey = async function _createKey(acct, branch) {
if (branch == null) { if (branch == null) {
branch = acct; branch = acct;
acct = null; acct = null;
@ -1190,7 +1190,7 @@ Wallet.prototype.importKey = async function importKey(acct, ring, passphrase) {
* @returns {Promise} * @returns {Promise}
*/ */
Wallet.prototype._importKey = async function importKey(acct, ring, passphrase) { Wallet.prototype._importKey = async function _importKey(acct, ring, passphrase) {
if (acct && typeof acct === 'object') { if (acct && typeof acct === 'object') {
passphrase = ring; passphrase = ring;
ring = acct; ring = acct;
@ -1274,7 +1274,7 @@ Wallet.prototype.importAddress = async function importAddress(acct, address) {
* @returns {Promise} * @returns {Promise}
*/ */
Wallet.prototype._importAddress = async function importAddress(acct, address) { Wallet.prototype._importAddress = async function _importAddress(acct, address) {
if (!address) { if (!address) {
address = acct; address = acct;
acct = null; acct = null;
@ -1354,7 +1354,7 @@ Wallet.prototype.fund = async function fund(mtx, options, force) {
* @see MTX#fill * @see MTX#fill
*/ */
Wallet.prototype._fund = async function fund(mtx, options) { Wallet.prototype._fund = async function _fund(mtx, options) {
if (!options) if (!options)
options = {}; options = {};
@ -1583,7 +1583,7 @@ Wallet.prototype.send = async function send(options, passphrase) {
* @returns {Promise} - Returns {@link TX}. * @returns {Promise} - Returns {@link TX}.
*/ */
Wallet.prototype._send = async function send(options, passphrase) { Wallet.prototype._send = async function _send(options, passphrase) {
const mtx = await this.createTX(options, true); const mtx = await this.createTX(options, true);
await this.sign(mtx, passphrase); await this.sign(mtx, passphrase);
@ -1883,7 +1883,7 @@ Wallet.prototype.setLookahead = async function setLookahead(acct, lookahead) {
* @returns {Promise} * @returns {Promise}
*/ */
Wallet.prototype._setLookahead = async function setLookahead(acct, lookahead) { Wallet.prototype._setLookahead = async function _setLookahead(acct, lookahead) {
if (lookahead == null) { if (lookahead == null) {
lookahead = acct; lookahead = acct;
acct = null; acct = null;
@ -2130,7 +2130,7 @@ Wallet.prototype.add = async function add(tx, block) {
* @returns {Promise} * @returns {Promise}
*/ */
Wallet.prototype._add = async function add(tx, block) { Wallet.prototype._add = async function _add(tx, block) {
this.txdb.start(); this.txdb.start();
let details, derived; let details, derived;
@ -2207,7 +2207,7 @@ Wallet.prototype.zap = async function zap(acct, age) {
* @returns {Promise} * @returns {Promise}
*/ */
Wallet.prototype._zap = async function zap(acct, age) { Wallet.prototype._zap = async function _zap(acct, age) {
const account = await this.ensureIndex(acct); const account = await this.ensureIndex(acct);
return await this.txdb.zap(account, age); return await this.txdb.zap(account, age);
}; };
@ -2234,7 +2234,7 @@ Wallet.prototype.abandon = async function abandon(hash) {
* @returns {Promise} * @returns {Promise}
*/ */
Wallet.prototype._abandon = function abandon(hash) { Wallet.prototype._abandon = function _abandon(hash) {
return this.txdb.abandon(hash); return this.txdb.abandon(hash);
}; };

View File

@ -138,7 +138,7 @@ WalletDB.prototype._init = function _init() {
* @returns {Promise} * @returns {Promise}
*/ */
WalletDB.prototype._open = async function open() { WalletDB.prototype._open = async function _open() {
if (this.options.listen) if (this.options.listen)
await this.logger.open(); await this.logger.open();
@ -179,7 +179,7 @@ WalletDB.prototype._open = async function open() {
* @returns {Promise} * @returns {Promise}
*/ */
WalletDB.prototype._close = async function close() { WalletDB.prototype._close = async function _close() {
await this.disconnect(); await this.disconnect();
if (this.http && this.options.listen) if (this.http && this.options.listen)
@ -487,7 +487,7 @@ WalletDB.prototype.rescan = async function rescan(height) {
* @returns {Promise} * @returns {Promise}
*/ */
WalletDB.prototype._rescan = async function rescan(height) { WalletDB.prototype._rescan = async function _rescan(height) {
return await this.scan(height); return await this.scan(height);
}; };
@ -864,7 +864,7 @@ WalletDB.prototype.get = async function get(id) {
* @returns {Promise} - Returns {@link Wallet}. * @returns {Promise} - Returns {@link Wallet}.
*/ */
WalletDB.prototype._get = async function get(wid) { WalletDB.prototype._get = async function _get(wid) {
const cache = this.wallets.get(wid); const cache = this.wallets.get(wid);
if (cache) if (cache)
@ -1020,7 +1020,7 @@ WalletDB.prototype.create = async function create(options) {
* @returns {Promise} - Returns {@link Wallet}. * @returns {Promise} - Returns {@link Wallet}.
*/ */
WalletDB.prototype._create = async function create(options) { WalletDB.prototype._create = async function _create(options) {
const exists = await this.has(options.id); const exists = await this.has(options.id);
if (exists) if (exists)
@ -1891,7 +1891,7 @@ WalletDB.prototype.addBlock = async function addBlock(entry, txs) {
* @returns {Promise} * @returns {Promise}
*/ */
WalletDB.prototype._addBlock = async function addBlock(entry, txs) { WalletDB.prototype._addBlock = async function _addBlock(entry, txs) {
const tip = BlockMeta.fromEntry(entry); const tip = BlockMeta.fromEntry(entry);
let total = 0; let total = 0;
@ -1958,7 +1958,7 @@ WalletDB.prototype.removeBlock = async function removeBlock(entry) {
* @returns {Promise} * @returns {Promise}
*/ */
WalletDB.prototype._removeBlock = async function removeBlock(entry) { WalletDB.prototype._removeBlock = async function _removeBlock(entry) {
const tip = BlockMeta.fromEntry(entry); const tip = BlockMeta.fromEntry(entry);
if (tip.height > this.state.height) { if (tip.height > this.state.height) {
@ -2048,7 +2048,7 @@ WalletDB.prototype.addTX = async function addTX(tx) {
* @returns {Promise} * @returns {Promise}
*/ */
WalletDB.prototype._insert = async function insert(tx, block) { WalletDB.prototype._insert = async function _insert(tx, block) {
const wids = await this.getWalletsByTX(tx); const wids = await this.getWalletsByTX(tx);
let result = false; let result = false;
@ -2095,7 +2095,7 @@ WalletDB.prototype._insert = async function insert(tx, block) {
* @returns {Promise} * @returns {Promise}
*/ */
WalletDB.prototype._unconfirm = async function unconfirm(tx) { WalletDB.prototype._unconfirm = async function _unconfirm(tx) {
for (const wid of tx.wids) { for (const wid of tx.wids) {
const wallet = await this.get(wid); const wallet = await this.get(wid);
assert(wallet); assert(wallet);
@ -2125,7 +2125,7 @@ WalletDB.prototype.resetChain = async function resetChain(entry) {
* @returns {Promise} * @returns {Promise}
*/ */
WalletDB.prototype._resetChain = async function resetChain(entry) { WalletDB.prototype._resetChain = async function _resetChain(entry) {
if (entry.height > this.state.height) if (entry.height > this.state.height)
throw new Error('WDB: Bad reset height.'); throw new Error('WDB: Bad reset height.');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -21,6 +21,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict'; 'use strict';
const assert = require('assert'); const assert = require('assert');