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": {
"browser": true,
"es6": true,
"mocha": true,
"node": true
},
"extends": "eslint:recommended",

View File

@ -433,7 +433,7 @@ CLI.prototype.importKey = async function importKey() {
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 account = this.config.str('account');
await this.wallet.importAddress(account, address);

View File

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

View File

@ -96,7 +96,7 @@ util.inherits(Chain, AsyncObject);
* @returns {Promise}
*/
Chain.prototype._open = async function open() {
Chain.prototype._open = async function _open() {
this.logger.info('Chain is loading.');
if (this.options.checkpoints)
@ -141,7 +141,7 @@ Chain.prototype._open = async function open() {
* @returns {Promise}
*/
Chain.prototype._close = function close() {
Chain.prototype._close = function _close() {
return this.db.close();
};
@ -194,7 +194,7 @@ Chain.prototype.verifyBlock = async function verifyBlock(block) {
* @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;
return await this.verifyContext(block, this.tip, flags);
};
@ -1078,7 +1078,7 @@ Chain.prototype.reset = async function reset(block) {
* @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);
// Reset state.
@ -1129,7 +1129,7 @@ Chain.prototype.replay = async function replay(block) {
* @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);
if (!entry)
@ -1234,7 +1234,7 @@ Chain.prototype.add = async function add(block, flags, id) {
* @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');
if (flags == null)
@ -1861,7 +1861,7 @@ Chain.prototype.getLocator = async function getLocator(start) {
* @returns {Promise}
*/
Chain.prototype._getLocator = async function getLocator(start) {
Chain.prototype._getLocator = async function _getLocator(start) {
if (start == null)
start = this.tip.hash;

View File

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

View File

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

View File

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

View File

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

View File

@ -22,7 +22,7 @@ DB.prototype.get = function 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))
key = key.toString('hex');
this.level.put(key, value, options, callback);

View File

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

View File

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

View File

@ -1597,7 +1597,7 @@ RPC.prototype.generate = async function generate(args, help) {
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) {
throw new RPCError(errs.MISC_ERROR,
'generatetoaddress numblocks address ( maxtries )');

View File

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

View File

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

View File

@ -68,7 +68,7 @@ Miner.prototype.init = function init() {
* @returns {Promise}
*/
Miner.prototype._open = async function open() {
Miner.prototype._open = async function _open() {
await this.chain.open();
if (this.mempool)
@ -90,7 +90,7 @@ Miner.prototype._open = async function open() {
* @returns {Promise}
*/
Miner.prototype._close = async function close() {
Miner.prototype._close = async function _close() {
await this.cpu.close();
};
@ -120,7 +120,7 @@ Miner.prototype.createBlock = async function createBlock(tip, address) {
* @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;
if (!tip)

View File

@ -407,7 +407,7 @@ BIP150.prototype.wait = function wait(timeout) {
* @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.');
this.job = co.job(resolve, reject);

View File

@ -527,7 +527,7 @@ BIP151.prototype.wait = function wait(timeout) {
* @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.');
this.job = co.job(resolve, reject);

View File

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

View File

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

View File

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

View File

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

View File

@ -217,7 +217,7 @@ FullNode.prototype._init = function _init() {
* @returns {Promise}
*/
FullNode.prototype._open = async function open() {
FullNode.prototype._open = async function _open() {
await this.chain.open();
await this.mempool.open();
await this.miner.open();
@ -237,7 +237,7 @@ FullNode.prototype._open = async function open() {
* @returns {Promise}
*/
FullNode.prototype._close = async function close() {
FullNode.prototype._close = async function _close() {
if (this.http)
await this.http.close();
@ -425,7 +425,7 @@ FullNode.prototype.getCoinsByAddress = async function getCoinsByAddress(addrs) {
* @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 chain = await this.chain.db.getMetaByAddress(addrs);
return chain.concat(mempool);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -101,13 +101,12 @@ BufferReader.prototype.start = function start() {
* @throws on empty stack.
*/
BufferReader.prototype.end = function _end() {
BufferReader.prototype.end = function end() {
assert(this.stack.length > 0);
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}
*/
util.startsWith = function startsWiths(str, prefix) {
util.startsWith = function startsWith(str, prefix) {
return str.startsWith(prefix);
};

View File

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

View File

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

View File

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

View File

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

View File

@ -37,7 +37,7 @@ util.inherits(NodeClient, AsyncObject);
* @returns {Promise}
*/
NodeClient.prototype._init = function init() {
NodeClient.prototype._init = function _init() {
this.node.on('connect', (entry, block) => {
if (!this.listen)
return;
@ -72,7 +72,7 @@ NodeClient.prototype._init = function init() {
* @returns {Promise}
*/
NodeClient.prototype._open = function open(options) {
NodeClient.prototype._open = function _open(options) {
this.listen = true;
return Promise.resolve();
};
@ -82,7 +82,7 @@ NodeClient.prototype._open = function open(options) {
* @returns {Promise}
*/
NodeClient.prototype._close = function close() {
NodeClient.prototype._close = function _close() {
this.listen = false;
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) {
if (help || args.length !== 1 || !dest)
throw new RPCError(errs.MISC_ERROR, 'backupwallet "destination"');
const valid = new Validator([args]);
const dest = valid.str(0);
if (help || args.length !== 1 || !dest)
throw new RPCError(errs.MISC_ERROR, 'backupwallet "destination"');
await this.wdb.backup(dest);
return null;

View File

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

View File

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

View File

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

View File

@ -1,3 +1,5 @@
/* eslint-env mocha */
'use strict';
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
// THE SOFTWARE.
/* eslint-env mocha */
'use strict';
const assert = require('assert');

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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