bcoin: lint.
This commit is contained in:
parent
73664efcd0
commit
163e89fc29
2
bin/cli
2
bin/cli
@ -716,7 +716,7 @@ class CLI {
|
||||
this.log(' $ resend: Resend pending transactions.');
|
||||
this.log(' $ rescan [height]: Rescan for transactions.');
|
||||
this.log('Other Options:');
|
||||
this.log(' --passphrase [passphrase]: For signing & account creation.');
|
||||
this.log(' --passphrase [passphrase]: For signing/account-creation.');
|
||||
this.log(' --account [account-name]: Account name.');
|
||||
break;
|
||||
}
|
||||
|
||||
@ -363,7 +363,7 @@ class ConfirmStats {
|
||||
throw new Error('Mismatch in tx count bucket count.');
|
||||
|
||||
if (maxConfirms <= 0 || maxConfirms > 6 * 24 * 7)
|
||||
throw new Error('Must maintain estimates for between 1 and 1008 confirms.');
|
||||
throw new Error('Must maintain estimates for between 1-1008 confirms.');
|
||||
|
||||
for (let i = 0; i < maxConfirms; i++) {
|
||||
if (confAvg[i].length !== buckets.length)
|
||||
|
||||
@ -155,7 +155,7 @@ class Miner extends EventEmitter {
|
||||
this.assemble(attempt);
|
||||
|
||||
this.logger.debug(
|
||||
'Created block template (height=%d, weight=%d, fees=%d, txs=%s, diff=%d).',
|
||||
'Created block tmpl (height=%d, weight=%d, fees=%d, txs=%s, diff=%d).',
|
||||
attempt.height,
|
||||
attempt.weight,
|
||||
Amount.btc(attempt.fees),
|
||||
|
||||
@ -2322,16 +2322,6 @@ class SendCmpctPacket extends Packet {
|
||||
return new this().fromReader(br);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate sendcmpct packet from buffer reader.
|
||||
* @param {BufferReader} br
|
||||
* @returns {SendCmpctPacket}
|
||||
*/
|
||||
|
||||
static fromReader(br) {
|
||||
return new this().fromReader(br);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate sendcmpct packet from serialized data.
|
||||
* @param {Buffer} data
|
||||
|
||||
@ -88,8 +88,10 @@ class Pool extends EventEmitter {
|
||||
this.hosts = new HostList(this.options);
|
||||
this.id = 0;
|
||||
|
||||
if (this.options.spv)
|
||||
this.spvFilter = BloomFilter.fromRate(20000, 0.001, BloomFilter.flags.ALL);
|
||||
if (this.options.spv) {
|
||||
this.spvFilter = BloomFilter.fromRate(
|
||||
20000, 0.001, BloomFilter.flags.ALL);
|
||||
}
|
||||
|
||||
if (!this.options.mempool)
|
||||
this.txFilter = new RollingFilter(50000, 0.000001);
|
||||
@ -1737,7 +1739,9 @@ class Pool extends EventEmitter {
|
||||
const items = packet.items;
|
||||
|
||||
if (items.length > 50000) {
|
||||
this.logger.warning('Peer sent inv with >50k items (%s).', peer.hostname());
|
||||
this.logger.warning(
|
||||
'Peer sent inv with >50k items (%s).',
|
||||
peer.hostname());
|
||||
peer.increaseBan(100);
|
||||
peer.destroy();
|
||||
return;
|
||||
@ -1827,12 +1831,16 @@ class Pool extends EventEmitter {
|
||||
|
||||
// Fallback to full block.
|
||||
if (height < this.chain.tip.height - 10) {
|
||||
const result = await this.sendBlock(peer, item, peer.compactWitness);
|
||||
const result = await this.sendBlock(
|
||||
peer, item, peer.compactWitness);
|
||||
|
||||
if (!result) {
|
||||
notFound.push(item);
|
||||
continue;
|
||||
}
|
||||
|
||||
blocks += 1;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -4163,6 +4171,7 @@ class PeerList {
|
||||
* Broadcast Item
|
||||
* Represents an item that is broadcasted via an inv/getdata cycle.
|
||||
* @alias module:net.BroadcastItem
|
||||
* @extends EventEmitter
|
||||
* @private
|
||||
* @emits BroadcastItem#ack
|
||||
* @emits BroadcastItem#reject
|
||||
@ -4178,6 +4187,8 @@ class BroadcastItem extends EventEmitter {
|
||||
*/
|
||||
|
||||
constructor(pool, msg) {
|
||||
super();
|
||||
|
||||
assert(!msg.mutable, 'Cannot broadcast mutable item.');
|
||||
|
||||
const item = msg.toInv();
|
||||
|
||||
@ -154,7 +154,9 @@ class Node extends EventEmitter {
|
||||
await this.workers.open();
|
||||
|
||||
this._bind(this.network.time, 'offset', (offset) => {
|
||||
this.logger.info('Time offset: %d (%d minutes).', offset, offset / 60 | 0);
|
||||
this.logger.info(
|
||||
'Time offset: %d (%d minutes).',
|
||||
offset, offset / 60 | 0);
|
||||
});
|
||||
|
||||
this._bind(this.network.time, 'sample', (sample, total) => {
|
||||
|
||||
@ -11,7 +11,6 @@ const assert = require('assert');
|
||||
const bio = require('bufio');
|
||||
const Amount = require('../btc/amount');
|
||||
const Output = require('./output');
|
||||
const Script = require('../script/script');
|
||||
const Network = require('../protocol/network');
|
||||
const {encoding} = bio;
|
||||
|
||||
|
||||
@ -13,7 +13,6 @@ const Network = require('../protocol/network');
|
||||
const Script = require('../script/script');
|
||||
const Witness = require('../script/witness');
|
||||
const Outpoint = require('./outpoint');
|
||||
const {encoding} = bio;
|
||||
|
||||
/**
|
||||
* Input
|
||||
|
||||
@ -88,7 +88,8 @@ class Output {
|
||||
script = Script.fromAddress(script);
|
||||
|
||||
assert(script instanceof Script, 'Script must be a Script.');
|
||||
assert(Number.isSafeInteger(value) && value >= 0, 'Value must be a uint64.');
|
||||
assert(Number.isSafeInteger(value) && value >= 0,
|
||||
'Value must be a uint64.');
|
||||
|
||||
this.script = script;
|
||||
this.value = value;
|
||||
|
||||
@ -2199,7 +2199,8 @@ class TX {
|
||||
assert((json.version >>> 0) === json.version, 'Version must be a uint32.');
|
||||
assert(Array.isArray(json.inputs), 'Inputs must be an array.');
|
||||
assert(Array.isArray(json.outputs), 'Outputs must be an array.');
|
||||
assert((json.locktime >>> 0) === json.locktime, 'Locktime must be a uint32.');
|
||||
assert((json.locktime >>> 0) === json.locktime,
|
||||
'Locktime must be a uint32.');
|
||||
|
||||
this.version = json.version;
|
||||
|
||||
|
||||
@ -513,7 +513,7 @@ class Script {
|
||||
* @param {Number?} index - Index of input being verified.
|
||||
* @param {Amount?} value - Previous output value.
|
||||
* @param {Number?} version - Signature hash version (0=legacy, 1=segwit).
|
||||
* @throws {ScriptError} Will be thrown on VERIFY failures, among other things.
|
||||
* @throws {ScriptError} Will be thrown on VERIFY failures.
|
||||
*/
|
||||
|
||||
execute(stack, flags, tx, index, value, version) {
|
||||
@ -1133,7 +1133,13 @@ class Script {
|
||||
|
||||
if (sig.length > 0) {
|
||||
const type = sig[sig.length - 1];
|
||||
const hash = tx.signatureHash(index, subscript, value, type, version);
|
||||
const hash = tx.signatureHash(
|
||||
index,
|
||||
subscript,
|
||||
value,
|
||||
type,
|
||||
version
|
||||
);
|
||||
res = checksig(hash, sig, key);
|
||||
}
|
||||
|
||||
|
||||
@ -2053,7 +2053,7 @@ class TXDB {
|
||||
/**
|
||||
* Zap pending transactions older than `age`.
|
||||
* @param {Number} acct
|
||||
* @param {Number} age - Age delta (delete transactions older than `now - age`).
|
||||
* @param {Number} age - Age delta.
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
|
||||
@ -69,13 +69,15 @@ async function checkTipIndex() {
|
||||
console.log('No tip index found.');
|
||||
console.log('Please run migrate/ensure-tip-index.js first!');
|
||||
process.exit(1);
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (keys.length < 3) {
|
||||
console.log('Note: please run ensure-tip-index.js if you haven\'t yet.');
|
||||
return new Promise(r => setTimeout(r, 2000));
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async function updateOptions() {
|
||||
|
||||
@ -91,7 +91,7 @@ async function updateTXDB() {
|
||||
|
||||
function fromExtended(data, saveCoins) {
|
||||
const tx = new TX();
|
||||
const p = BufferReader(data);
|
||||
const p = bio.read(data);
|
||||
|
||||
tx.fromRaw(p);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user