bcoin: update logger usage.
This commit is contained in:
parent
5b56323310
commit
a0ac953079
@ -889,10 +889,10 @@ class Chain extends AsyncEmitter {
|
||||
}
|
||||
|
||||
this.logger.warning(
|
||||
'Chain reorganization: old=%s(%d) new=%s(%d)',
|
||||
tip.rhash(),
|
||||
'Chain reorganization: old=%h(%d) new=%h(%d)',
|
||||
tip.hash,
|
||||
tip.height,
|
||||
competitor.rhash(),
|
||||
competitor.hash,
|
||||
competitor.height
|
||||
);
|
||||
|
||||
@ -937,10 +937,10 @@ class Chain extends AsyncEmitter {
|
||||
}
|
||||
|
||||
this.logger.warning(
|
||||
'SPV reorganization: old=%s(%d) new=%s(%d)',
|
||||
tip.rhash(),
|
||||
'SPV reorganization: old=%h(%d) new=%h(%d)',
|
||||
tip.hash,
|
||||
tip.height,
|
||||
competitor.rhash(),
|
||||
competitor.hash,
|
||||
competitor.height
|
||||
);
|
||||
|
||||
@ -1011,8 +1011,8 @@ class Chain extends AsyncEmitter {
|
||||
if (!err.malleated)
|
||||
this.setInvalid(entry.hash);
|
||||
this.logger.warning(
|
||||
'Tried to reconnect invalid block: %s (%d).',
|
||||
entry.rhash(), entry.height);
|
||||
'Tried to reconnect invalid block: %h (%d).',
|
||||
entry.hash, entry.height);
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
@ -1075,8 +1075,8 @@ class Chain extends AsyncEmitter {
|
||||
if (!err.malleated)
|
||||
this.setInvalid(entry.hash);
|
||||
this.logger.warning(
|
||||
'Tried to connect invalid block: %s (%d).',
|
||||
entry.rhash(), entry.height);
|
||||
'Tried to connect invalid block: %h (%d).',
|
||||
entry.hash, entry.height);
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
@ -1115,8 +1115,8 @@ class Chain extends AsyncEmitter {
|
||||
if (!err.malleated)
|
||||
this.setInvalid(entry.hash);
|
||||
this.logger.warning(
|
||||
'Invalid block on alternate chain: %s (%d).',
|
||||
entry.rhash(), entry.height);
|
||||
'Invalid block on alternate chain: %h (%d).',
|
||||
entry.hash, entry.height);
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
@ -1132,14 +1132,14 @@ class Chain extends AsyncEmitter {
|
||||
|
||||
this.logger.warning('Heads up: Competing chain at height %d:'
|
||||
+ ' tip-height=%d competitor-height=%d'
|
||||
+ ' tip-hash=%s competitor-hash=%s'
|
||||
+ ' tip-hash=%h competitor-hash=%h'
|
||||
+ ' tip-chainwork=%s competitor-chainwork=%s'
|
||||
+ ' chainwork-diff=%s',
|
||||
entry.height,
|
||||
this.tip.height,
|
||||
entry.height,
|
||||
this.tip.rhash(),
|
||||
entry.rhash(),
|
||||
this.tip.hash,
|
||||
entry.hash,
|
||||
this.tip.chainwork.toString(),
|
||||
entry.chainwork.toString(),
|
||||
this.tip.chainwork.sub(entry.chainwork).toString());
|
||||
@ -1333,26 +1333,26 @@ class Chain extends AsyncEmitter {
|
||||
|
||||
// Special case for genesis block.
|
||||
if (hash.equals(this.network.genesis.hash)) {
|
||||
this.logger.debug('Saw genesis block: %s.', block.rhash());
|
||||
this.logger.debug('Saw genesis block: %h.', block.hash());
|
||||
throw new VerifyError(block, 'duplicate', 'duplicate', 0);
|
||||
}
|
||||
|
||||
// Do we already have this block in the queue?
|
||||
if (this.hasPending(hash)) {
|
||||
this.logger.debug('Already have pending block: %s.', block.rhash());
|
||||
this.logger.debug('Already have pending block: %h.', block.hash());
|
||||
throw new VerifyError(block, 'duplicate', 'duplicate', 0);
|
||||
}
|
||||
|
||||
// If the block is already known to be
|
||||
// an orphan, ignore it.
|
||||
if (this.hasOrphan(hash)) {
|
||||
this.logger.debug('Already have orphan block: %s.', block.rhash());
|
||||
this.logger.debug('Already have orphan block: %h.', block.hash());
|
||||
throw new VerifyError(block, 'duplicate', 'duplicate', 0);
|
||||
}
|
||||
|
||||
// Do not revalidate known invalid blocks.
|
||||
if (this.hasInvalid(block)) {
|
||||
this.logger.debug('Invalid ancestors for block: %s.', block.rhash());
|
||||
this.logger.debug('Invalid ancestors for block: %h.', block.hash());
|
||||
throw new VerifyError(block, 'duplicate', 'duplicate', 100);
|
||||
}
|
||||
|
||||
@ -1364,7 +1364,7 @@ class Chain extends AsyncEmitter {
|
||||
|
||||
// Do we already have this block?
|
||||
if (await this.hasEntry(hash)) {
|
||||
this.logger.debug('Already have block: %s.', block.rhash());
|
||||
this.logger.debug('Already have block: %h.', block.hash());
|
||||
throw new VerifyError(block, 'duplicate', 'duplicate', 0);
|
||||
}
|
||||
|
||||
@ -1468,8 +1468,8 @@ class Chain extends AsyncEmitter {
|
||||
} catch (err) {
|
||||
if (err.type === 'VerifyError') {
|
||||
this.logger.warning(
|
||||
'Could not resolve orphan block %s: %s.',
|
||||
block.rhash(), err.message);
|
||||
'Could not resolve orphan block %h: %s.',
|
||||
block.hash(), err.message);
|
||||
|
||||
this.emit('bad orphan', err, id);
|
||||
|
||||
@ -1479,8 +1479,8 @@ class Chain extends AsyncEmitter {
|
||||
}
|
||||
|
||||
this.logger.debug(
|
||||
'Orphan block was resolved: %s (%d).',
|
||||
block.rhash(), entry.height);
|
||||
'Orphan block was resolved: %h (%d).',
|
||||
block.hash(), entry.height);
|
||||
|
||||
this.emit('resolved', block, entry);
|
||||
|
||||
@ -1529,8 +1529,8 @@ class Chain extends AsyncEmitter {
|
||||
const elapsed = util.bench(start);
|
||||
|
||||
this.logger.info(
|
||||
'Block %s (%d) added to chain (size=%d txs=%d time=%d).',
|
||||
entry.rhash(),
|
||||
'Block %h (%d) added to chain (size=%d txs=%d time=%d).',
|
||||
entry.hash,
|
||||
entry.height,
|
||||
block.getSize(),
|
||||
block.txs.length,
|
||||
@ -1561,8 +1561,8 @@ class Chain extends AsyncEmitter {
|
||||
return true;
|
||||
|
||||
if (hash.equals(checkpoint)) {
|
||||
this.logger.debug('Hit checkpoint block %s (%d).',
|
||||
util.revHex(hash), height);
|
||||
this.logger.debug('Hit checkpoint block %h (%d).',
|
||||
hash, height);
|
||||
this.emit('checkpoint', hash, height);
|
||||
return true;
|
||||
}
|
||||
@ -1572,10 +1572,10 @@ class Chain extends AsyncEmitter {
|
||||
// consensus protocol is broken and
|
||||
// there was a 20k+ block reorg.
|
||||
this.logger.warning(
|
||||
'Checkpoint mismatch at height %d: expected=%s received=%s',
|
||||
'Checkpoint mismatch at height %d: expected=%h received=%h',
|
||||
height,
|
||||
util.revHex(checkpoint),
|
||||
util.revHex(hash)
|
||||
checkpoint,
|
||||
hash
|
||||
);
|
||||
|
||||
this.purgeOrphans();
|
||||
@ -1601,8 +1601,8 @@ class Chain extends AsyncEmitter {
|
||||
assert(orphan.block.prevBlock.equals(block.prevBlock));
|
||||
|
||||
this.logger.warning(
|
||||
'Removing forked orphan block: %s (%d).',
|
||||
orphan.block.rhash(), height);
|
||||
'Removing forked orphan block: %h (%d).',
|
||||
orphan.block.hash(), height);
|
||||
|
||||
this.removeOrphan(orphan);
|
||||
}
|
||||
@ -1611,8 +1611,8 @@ class Chain extends AsyncEmitter {
|
||||
this.addOrphan(new Orphan(block, flags, id));
|
||||
|
||||
this.logger.debug(
|
||||
'Storing orphan block: %s (%d).',
|
||||
block.rhash(), height);
|
||||
'Storing orphan block: %h (%d).',
|
||||
block.hash(), height);
|
||||
|
||||
this.emit('orphan', block);
|
||||
}
|
||||
|
||||
@ -91,8 +91,8 @@ class ChainDB {
|
||||
}
|
||||
|
||||
this.logger.info(
|
||||
'Chain State: hash=%s tx=%d coin=%d value=%s.',
|
||||
this.state.rhash(),
|
||||
'Chain State: hash=%h tx=%d coin=%d value=%s.',
|
||||
this.state.tip,
|
||||
this.state.tx,
|
||||
this.state.coin,
|
||||
Amount.btc(this.state.value));
|
||||
@ -1265,7 +1265,7 @@ class ChainDB {
|
||||
if (typeof start === 'number')
|
||||
this.logger.info('Scanning from height %d.', start);
|
||||
else
|
||||
this.logger.info('Scanning from block %s.', util.revHex(start));
|
||||
this.logger.info('Scanning from block %h.', start);
|
||||
|
||||
let entry = await this.getEntry(start);
|
||||
|
||||
@ -1292,8 +1292,8 @@ class ChainDB {
|
||||
}
|
||||
|
||||
this.logger.info(
|
||||
'Scanning block %s (%d).',
|
||||
entry.rhash(), entry.height);
|
||||
'Scanning block %h (%d).',
|
||||
entry.hash, entry.height);
|
||||
|
||||
for (let i = 0; i < block.txs.length; i++) {
|
||||
const tx = block.txs[i];
|
||||
@ -1558,7 +1558,7 @@ class ChainDB {
|
||||
let tip = await this.getTip();
|
||||
assert(tip);
|
||||
|
||||
this.logger.debug('Resetting main chain to: %s', entry.rhash());
|
||||
this.logger.debug('Resetting main chain to: %h', entry.hash);
|
||||
|
||||
for (;;) {
|
||||
this.start();
|
||||
@ -1643,7 +1643,7 @@ class ChainDB {
|
||||
if (!tip)
|
||||
throw new Error('Alternate chain tip not found.');
|
||||
|
||||
this.logger.debug('Removing alternate chain: %s.', tip.rhash());
|
||||
this.logger.debug('Removing alternate chain: %h.', tip.hash);
|
||||
|
||||
for (;;) {
|
||||
if (await this.isMainChain(tip))
|
||||
@ -2128,10 +2128,6 @@ class ChainState {
|
||||
this.committed = false;
|
||||
}
|
||||
|
||||
rhash() {
|
||||
return util.revHex(this.tip);
|
||||
}
|
||||
|
||||
clone() {
|
||||
const state = new ChainState();
|
||||
state.tip = this.tip;
|
||||
|
||||
@ -490,7 +490,7 @@ class PolicyEstimator {
|
||||
const item = this.map.get(hash);
|
||||
|
||||
if (!item) {
|
||||
this.logger.spam('Mempool tx %s not found.', util.revHex(hash));
|
||||
this.logger.spam('Mempool tx %h not found.', hash);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -540,7 +540,7 @@ class PolicyEstimator {
|
||||
const hash = entry.hash();
|
||||
|
||||
if (this.map.has(hash)) {
|
||||
this.logger.debug('Mempool tx %s already tracked.', entry.txid());
|
||||
this.logger.debug('Mempool tx %h already tracked.', entry.hash());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -560,7 +560,7 @@ class PolicyEstimator {
|
||||
const rate = entry.getRate();
|
||||
const priority = entry.getPriority(height);
|
||||
|
||||
this.logger.spam('Processing mempool tx %s.', entry.txid());
|
||||
this.logger.spam('Processing mempool tx %h.', entry.hash());
|
||||
|
||||
if (fee === 0 || this.isPriPoint(rate, priority)) {
|
||||
const item = new StatEntry();
|
||||
@ -573,7 +573,7 @@ class PolicyEstimator {
|
||||
item.bucketIndex = this.feeStats.addTX(height, rate);
|
||||
this.map.set(hash, item);
|
||||
} else {
|
||||
this.logger.spam('Not adding tx %s.', entry.txid());
|
||||
this.logger.spam('Not adding tx %h.', entry.hash());
|
||||
}
|
||||
}
|
||||
|
||||
@ -592,8 +592,8 @@ class PolicyEstimator {
|
||||
|
||||
if (blocks <= 0) {
|
||||
this.logger.debug(
|
||||
'Block tx %s had negative blocks to confirm (%d, %d).',
|
||||
entry.txid(),
|
||||
'Block tx %h had negative blocks to confirm (%d, %d).',
|
||||
entry.hash(),
|
||||
height,
|
||||
entry.height);
|
||||
return;
|
||||
|
||||
@ -413,8 +413,8 @@ class Mempool extends EventEmitter {
|
||||
}
|
||||
|
||||
this.logger.debug(
|
||||
'Removing package %s from mempool (too old).',
|
||||
entry.txid());
|
||||
'Removing package %h from mempool (too old).',
|
||||
entry.hash());
|
||||
|
||||
this.evictEntry(entry);
|
||||
}
|
||||
@ -439,8 +439,8 @@ class Mempool extends EventEmitter {
|
||||
assert(this.hasEntry(hash));
|
||||
|
||||
this.logger.debug(
|
||||
'Removing package %s from mempool (low fee).',
|
||||
entry.txid());
|
||||
'Removing package %h from mempool (low fee).',
|
||||
entry.hash());
|
||||
|
||||
this.evictEntry(entry);
|
||||
|
||||
@ -1096,8 +1096,8 @@ class Mempool extends EventEmitter {
|
||||
this.fees.processTX(entry, this.chain.synced);
|
||||
|
||||
this.logger.debug(
|
||||
'Added %s to mempool (txs=%d).',
|
||||
tx.txid(), this.map.size);
|
||||
'Added %h to mempool (txs=%d).',
|
||||
tx.hash(), this.map.size);
|
||||
|
||||
this.cache.save(entry);
|
||||
|
||||
@ -1451,16 +1451,16 @@ class Mempool extends EventEmitter {
|
||||
|
||||
if (this.hasReject(prevout.hash)) {
|
||||
this.logger.debug(
|
||||
'Not storing orphan %s (rejected parents).',
|
||||
tx.txid());
|
||||
'Not storing orphan %h (rejected parents).',
|
||||
tx.hash());
|
||||
this.rejects.add(tx.hash());
|
||||
return missing;
|
||||
}
|
||||
|
||||
if (this.hasEntry(prevout.hash)) {
|
||||
this.logger.debug(
|
||||
'Not storing orphan %s (non-existent output).',
|
||||
tx.txid());
|
||||
'Not storing orphan %h (non-existent output).',
|
||||
tx.hash());
|
||||
this.rejects.add(tx.hash());
|
||||
return missing;
|
||||
}
|
||||
@ -1474,7 +1474,7 @@ class Mempool extends EventEmitter {
|
||||
|
||||
// Weight limit for orphans.
|
||||
if (tx.getWeight() > policy.MAX_TX_WEIGHT) {
|
||||
this.logger.debug('Ignoring large orphan: %s', tx.txid());
|
||||
this.logger.debug('Ignoring large orphan: %h', tx.hash());
|
||||
if (!tx.hasWitness())
|
||||
this.rejects.add(tx.hash());
|
||||
return missing;
|
||||
@ -1498,7 +1498,7 @@ class Mempool extends EventEmitter {
|
||||
|
||||
this.orphans.set(hash, new Orphan(tx, missing.length, id));
|
||||
|
||||
this.logger.debug('Added orphan %s to mempool.', tx.txid());
|
||||
this.logger.debug('Added orphan %h to mempool.', tx.hash());
|
||||
|
||||
this.emit('add orphan', tx);
|
||||
|
||||
@ -1532,8 +1532,8 @@ class Mempool extends EventEmitter {
|
||||
} catch (err) {
|
||||
if (err.type === 'VerifyError') {
|
||||
this.logger.debug(
|
||||
'Could not resolve orphan %s: %s.',
|
||||
tx.txid(), err.message);
|
||||
'Could not resolve orphan %h: %s.',
|
||||
tx.hash(), err.message);
|
||||
|
||||
if (!tx.hasWitness() && !err.malleated)
|
||||
this.rejects.add(tx.hash());
|
||||
@ -1550,13 +1550,13 @@ class Mempool extends EventEmitter {
|
||||
// the non-present parents.
|
||||
if (missing && missing.length > 0) {
|
||||
this.logger.debug(
|
||||
'Transaction %s was double-orphaned in mempool.',
|
||||
tx.txid());
|
||||
'Transaction %h was double-orphaned in mempool.',
|
||||
tx.hash());
|
||||
this.removeOrphan(tx.hash());
|
||||
continue;
|
||||
}
|
||||
|
||||
this.logger.debug('Resolved orphan %s in mempool.', tx.txid());
|
||||
this.logger.debug('Resolved orphan %h in mempool.', tx.hash());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1660,8 +1660,7 @@ class Mempool extends EventEmitter {
|
||||
|
||||
assert(hash);
|
||||
|
||||
this.logger.debug('Removing orphan %s from mempool.',
|
||||
util.revHex(hash));
|
||||
this.logger.debug('Removing orphan %h from mempool.', hash);
|
||||
|
||||
this.removeOrphan(hash);
|
||||
|
||||
@ -1887,8 +1886,8 @@ class Mempool extends EventEmitter {
|
||||
continue;
|
||||
|
||||
this.logger.debug(
|
||||
'Removing double spender from mempool: %s.',
|
||||
spent.txid());
|
||||
'Removing double spender from mempool: %h.',
|
||||
spent.hash());
|
||||
|
||||
this.evictEntry(spent);
|
||||
|
||||
@ -2514,8 +2513,8 @@ class MempoolCache {
|
||||
tip = this.chain.tip.hash;
|
||||
|
||||
this.logger.info(
|
||||
'Mempool cache is empty. Writing tip %s.',
|
||||
util.revHex(tip));
|
||||
'Mempool cache is empty. Writing tip %h.',
|
||||
tip);
|
||||
|
||||
await this.init(tip);
|
||||
}
|
||||
@ -2534,9 +2533,9 @@ class MempoolCache {
|
||||
|
||||
if (!tip || !tip.equals(this.chain.tip.hash)) {
|
||||
this.logger.warning(
|
||||
'Mempool tip not consistent with chain tip (%s != %s)!',
|
||||
util.revHex(tip),
|
||||
this.chain.tip.rhash());
|
||||
'Mempool tip not consistent with chain tip (%h != %h)!',
|
||||
tip,
|
||||
this.chain.tip.hash);
|
||||
this.logger.warning('Invalidating mempool cache.');
|
||||
await this.wipe();
|
||||
return false;
|
||||
|
||||
@ -160,8 +160,7 @@ class CPUMiner extends EventEmitter {
|
||||
break;
|
||||
|
||||
// Log the block hex as a failsafe (in case we can't send it).
|
||||
this.logger.info('Found block: %d (%s).', entry.height, entry.rhash());
|
||||
this.logger.debug('Raw: %s', block.toRaw().toString('hex'));
|
||||
this.logger.info('Found block: %d (%h).', entry.height, entry.hash);
|
||||
|
||||
this.emit('block', block, entry);
|
||||
}
|
||||
@ -401,12 +400,12 @@ class CPUMiner extends EventEmitter {
|
||||
|
||||
sendStatus(job, nonce) {
|
||||
const attempt = job.attempt;
|
||||
const tip = util.revHex(attempt.prevBlock);
|
||||
const tip = attempt.prevBlock;
|
||||
const hashes = job.getHashes(nonce);
|
||||
const hashrate = job.getRate(nonce);
|
||||
|
||||
this.logger.info(
|
||||
'Status: hashrate=%dkhs hashes=%d target=%d height=%d tip=%s',
|
||||
'Status: hashrate=%dkhs hashes=%d target=%d height=%d tip=%h',
|
||||
Math.floor(hashrate / 1000),
|
||||
hashes,
|
||||
attempt.bits,
|
||||
|
||||
@ -1684,18 +1684,18 @@ class Peer extends EventEmitter {
|
||||
|
||||
let hash = null;
|
||||
if (packet.locator.length > 0)
|
||||
hash = util.revHex(packet.locator[0]);
|
||||
hash = packet.locator[0];
|
||||
|
||||
let end = null;
|
||||
if (stop)
|
||||
end = util.revHex(stop);
|
||||
end = stop;
|
||||
|
||||
this.logger.debug(
|
||||
'Requesting headers packet from peer with getheaders (%s).',
|
||||
this.hostname());
|
||||
|
||||
this.logger.debug(
|
||||
'Sending getheaders (hash=%s, stop=%s).',
|
||||
'Sending getheaders (hash=%h, stop=%h).',
|
||||
hash, end);
|
||||
|
||||
this.send(packet);
|
||||
@ -1712,18 +1712,18 @@ class Peer extends EventEmitter {
|
||||
|
||||
let hash = null;
|
||||
if (packet.locator.length > 0)
|
||||
hash = util.revHex(packet.locator[0]);
|
||||
hash = packet.locator[0];
|
||||
|
||||
let end = null;
|
||||
if (stop)
|
||||
end = util.revHex(stop);
|
||||
end = stop;
|
||||
|
||||
this.logger.debug(
|
||||
'Requesting inv packet from peer with getblocks (%s).',
|
||||
this.hostname());
|
||||
|
||||
this.logger.debug(
|
||||
'Sending getblocks (hash=%s, stop=%s).',
|
||||
'Sending getblocks (hash=%h, stop=%h).',
|
||||
hash, end);
|
||||
|
||||
this.send(packet);
|
||||
@ -1763,8 +1763,8 @@ class Peer extends EventEmitter {
|
||||
const reject = packets.RejectPacket.fromReason(code, reason, msg, hash);
|
||||
|
||||
if (msg) {
|
||||
this.logger.debug('Rejecting %s %s (%s): code=%s reason=%s.',
|
||||
msg, util.revHex(hash), this.hostname(), code, reason);
|
||||
this.logger.debug('Rejecting %s %h (%s): code=%s reason=%s.',
|
||||
msg, hash, this.hostname(), code, reason);
|
||||
} else {
|
||||
this.logger.debug('Rejecting packet from %s: code=%s reason=%s.',
|
||||
this.hostname(), code, reason);
|
||||
|
||||
@ -219,8 +219,8 @@ class Pool extends EventEmitter {
|
||||
this.headerTip = this.getNextTip(tip.height);
|
||||
this.headerChain.push(new HeaderEntry(tip.hash, tip.height));
|
||||
this.logger.info(
|
||||
'Initialized header chain to height %d (checkpoint=%s).',
|
||||
tip.height, util.revHex(this.headerTip.hash));
|
||||
'Initialized header chain to height %d (checkpoint=%h).',
|
||||
tip.height, this.headerTip.hash);
|
||||
}
|
||||
}
|
||||
|
||||
@ -954,9 +954,9 @@ class Pool extends EventEmitter {
|
||||
}
|
||||
|
||||
this.logger.debug(
|
||||
'Peer requested %s %s as a %s packet (%s).',
|
||||
'Peer requested %s %h as a %s packet (%s).',
|
||||
item.isTX() ? 'tx' : 'block',
|
||||
item.rhash(),
|
||||
item.hash(),
|
||||
item.hasWitness() ? 'witness' : 'normal',
|
||||
peer.hostname());
|
||||
|
||||
@ -1620,7 +1620,7 @@ class Pool extends EventEmitter {
|
||||
return;
|
||||
|
||||
this.logger.debug(
|
||||
'Received %s block hashes from peer (%s).',
|
||||
'Received %d block hashes from peer (%s).',
|
||||
hashes.length,
|
||||
peer.hostname());
|
||||
|
||||
@ -1853,7 +1853,7 @@ class Pool extends EventEmitter {
|
||||
|
||||
if (unknown !== -1) {
|
||||
this.logger.warning(
|
||||
'Peer sent an unknown getdata type: %s (%d).',
|
||||
'Peer sent an unknown getdata type: %d (%s).',
|
||||
unknown, peer.hostname());
|
||||
}
|
||||
}
|
||||
@ -1872,7 +1872,7 @@ class Pool extends EventEmitter {
|
||||
for (const item of items) {
|
||||
if (!this.resolveItem(peer, item)) {
|
||||
this.logger.warning(
|
||||
'Peer sent notfound for unrequested item: %s (%s).',
|
||||
'Peer sent notfound for unrequested item: %h (%s).',
|
||||
item.hash, peer.hostname());
|
||||
peer.destroy();
|
||||
return;
|
||||
@ -2071,7 +2071,7 @@ class Pool extends EventEmitter {
|
||||
}
|
||||
|
||||
this.logger.debug(
|
||||
'Received %s headers from peer (%s).',
|
||||
'Received %d headers from peer (%s).',
|
||||
headers.length,
|
||||
peer.hostname());
|
||||
|
||||
@ -2161,8 +2161,8 @@ class Pool extends EventEmitter {
|
||||
|
||||
if (!this.resolveBlock(peer, hash)) {
|
||||
this.logger.warning(
|
||||
'Received unrequested block: %s (%s).',
|
||||
block.rhash(), peer.hostname());
|
||||
'Received unrequested block: %h (%s).',
|
||||
block.hash(), peer.hostname());
|
||||
peer.destroy();
|
||||
return;
|
||||
}
|
||||
@ -2244,9 +2244,9 @@ class Pool extends EventEmitter {
|
||||
|
||||
if (!hash.equals(node.hash)) {
|
||||
this.logger.warning(
|
||||
'Header hash mismatch %s != %s (%s).',
|
||||
util.revHex(hash),
|
||||
util.revHex(node.hash),
|
||||
'Header hash mismatch %h != %h (%s).',
|
||||
hash,
|
||||
node.hash,
|
||||
peer.hostname());
|
||||
|
||||
peer.destroy();
|
||||
@ -2257,8 +2257,8 @@ class Pool extends EventEmitter {
|
||||
if (node.height < this.network.lastCheckpoint) {
|
||||
if (node.height === this.headerTip.height) {
|
||||
this.logger.info(
|
||||
'Received checkpoint %s (%d).',
|
||||
util.revHex(node.hash), node.height);
|
||||
'Received checkpoint %h (%d).',
|
||||
node.hash, node.height);
|
||||
|
||||
this.headerTip = this.getNextTip(node.height);
|
||||
|
||||
@ -2314,8 +2314,8 @@ class Pool extends EventEmitter {
|
||||
|
||||
if (!peer) {
|
||||
this.logger.warning(
|
||||
'Could not find offending peer for orphan: %s (%d).',
|
||||
util.revHex(err.hash), id);
|
||||
'Could not find offending peer for orphan: %h (%d).',
|
||||
err.hash, id);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2350,9 +2350,9 @@ class Pool extends EventEmitter {
|
||||
|
||||
if (this.chain.height % 2000 === 0) {
|
||||
this.logger.info(
|
||||
'Received 2000 more blocks (height=%d, hash=%s).',
|
||||
'Received 2000 more blocks (height=%d, hash=%h).',
|
||||
this.chain.height,
|
||||
block.rhash());
|
||||
block.hash());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2397,8 +2397,8 @@ class Pool extends EventEmitter {
|
||||
if (block.hasTX(hash)) {
|
||||
if (peer.merkleMap.has(hash)) {
|
||||
this.logger.warning(
|
||||
'Peer sent duplicate merkle tx: %s (%s).',
|
||||
tx.txid(), peer.hostname());
|
||||
'Peer sent duplicate merkle tx: %h (%s).',
|
||||
tx.hash(), peer.hostname());
|
||||
peer.increaseBan(100);
|
||||
return;
|
||||
}
|
||||
@ -2421,8 +2421,8 @@ class Pool extends EventEmitter {
|
||||
|
||||
if (!this.resolveTX(peer, hash)) {
|
||||
this.logger.warning(
|
||||
'Peer sent unrequested tx: %s (%s).',
|
||||
tx.txid(), peer.hostname());
|
||||
'Peer sent unrequested tx: %h (%s).',
|
||||
tx.hash(), peer.hostname());
|
||||
peer.destroy();
|
||||
return;
|
||||
}
|
||||
@ -2463,12 +2463,12 @@ class Pool extends EventEmitter {
|
||||
|
||||
async handleReject(peer, packet) {
|
||||
this.logger.warning(
|
||||
'Received reject (%s): msg=%s code=%s reason=%s hash=%s.',
|
||||
'Received reject (%s): msg=%s code=%s reason=%s hash=%h.',
|
||||
peer.hostname(),
|
||||
packet.message,
|
||||
packet.getCode(),
|
||||
packet.reason,
|
||||
packet.rhash());
|
||||
packet.hash);
|
||||
|
||||
if (!packet.hash)
|
||||
return;
|
||||
@ -2700,7 +2700,7 @@ class Pool extends EventEmitter {
|
||||
|
||||
if (this.compactBlocks.has(hash)) {
|
||||
this.logger.debug(
|
||||
'Already waiting for compact block %s (%s).',
|
||||
'Already waiting for compact block %h (%s).',
|
||||
hash, peer.hostname());
|
||||
return;
|
||||
}
|
||||
@ -2744,8 +2744,8 @@ class Pool extends EventEmitter {
|
||||
|
||||
if (!result) {
|
||||
this.logger.warning(
|
||||
'Siphash collision for %s. Requesting full block (%s).',
|
||||
block.rhash(), peer.hostname());
|
||||
'Siphash collision for %h. Requesting full block (%s).',
|
||||
block.hash(), peer.hostname());
|
||||
peer.getFullBlock(hash);
|
||||
peer.increaseBan(10);
|
||||
return;
|
||||
@ -2755,8 +2755,8 @@ class Pool extends EventEmitter {
|
||||
|
||||
if (full) {
|
||||
this.logger.debug(
|
||||
'Received full compact block %s (%s).',
|
||||
block.rhash(), peer.hostname());
|
||||
'Received full compact block %h (%s).',
|
||||
block.hash(), peer.hostname());
|
||||
const flags = chainCommon.flags.VERIFY_BODY;
|
||||
await this.addBlock(peer, block.toBlock(), flags);
|
||||
return;
|
||||
@ -2776,8 +2776,8 @@ class Pool extends EventEmitter {
|
||||
this.compactBlocks.add(hash);
|
||||
|
||||
this.logger.debug(
|
||||
'Received non-full compact block %s tx=%d/%d (%s).',
|
||||
block.rhash(), block.count, block.totalTX, peer.hostname());
|
||||
'Received non-full compact block %h tx=%d/%d (%s).',
|
||||
block.hash(), block.count, block.totalTX, peer.hostname());
|
||||
|
||||
peer.send(new packets.GetBlockTxnPacket(block.toRequest()));
|
||||
}
|
||||
@ -2824,8 +2824,8 @@ class Pool extends EventEmitter {
|
||||
}
|
||||
|
||||
this.logger.debug(
|
||||
'Sending blocktxn for %s to peer (%s).',
|
||||
block.rhash(),
|
||||
'Sending blocktxn for %h to peer (%s).',
|
||||
block.hash(),
|
||||
peer.hostname());
|
||||
|
||||
const res = BIP152.TXResponse.fromBlock(block, req);
|
||||
@ -2860,8 +2860,8 @@ class Pool extends EventEmitter {
|
||||
|
||||
if (!block.fillMissing(res)) {
|
||||
this.logger.warning(
|
||||
'Peer sent non-full blocktxn for %s. Requesting full block (%s).',
|
||||
block.rhash(),
|
||||
'Peer sent non-full blocktxn for %h. Requesting full block (%s).',
|
||||
block.hash(),
|
||||
peer.hostname());
|
||||
peer.getFullBlock(res.hash);
|
||||
peer.increaseBan(10);
|
||||
@ -2869,8 +2869,8 @@ class Pool extends EventEmitter {
|
||||
}
|
||||
|
||||
this.logger.debug(
|
||||
'Filled compact block %s (%s).',
|
||||
block.rhash(), peer.hostname());
|
||||
'Filled compact block %h (%s).',
|
||||
block.hash(), peer.hostname());
|
||||
|
||||
await this.addBlock(peer, block.toBlock(), flags);
|
||||
}
|
||||
@ -3358,7 +3358,7 @@ class Pool extends EventEmitter {
|
||||
|
||||
// If we recently rejected this item. Ignore.
|
||||
if (this.mempool.hasReject(hash)) {
|
||||
this.logger.spam('Saw known reject of %s.', util.revHex(hash));
|
||||
this.logger.spam('Saw known reject of %h.', hash);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -298,7 +298,7 @@ class FullNode extends Node {
|
||||
} catch (err) {
|
||||
if (err.type === 'VerifyError' && err.score === 0) {
|
||||
this.error(err);
|
||||
this.logger.warning('Verification failed for tx: %s.', tx.txid());
|
||||
this.logger.warning('Verification failed for tx: %h.', tx.hash());
|
||||
this.logger.warning('Attempting to broadcast anyway...');
|
||||
this.broadcast(tx);
|
||||
return;
|
||||
@ -307,7 +307,7 @@ class FullNode extends Node {
|
||||
}
|
||||
|
||||
if (missing) {
|
||||
this.logger.warning('TX was orphaned in mempool: %s.', tx.txid());
|
||||
this.logger.warning('TX was orphaned in mempool: %h.', tx.hash());
|
||||
this.logger.warning('Attempting to broadcast anyway...');
|
||||
this.broadcast(tx);
|
||||
return;
|
||||
|
||||
@ -1140,16 +1140,16 @@ class RPC extends RPCBase {
|
||||
entry = await this.chain.add(block);
|
||||
} catch (err) {
|
||||
if (err.type === 'VerifyError') {
|
||||
this.logger.warning('RPC block rejected: %s (%s).',
|
||||
block.rhash(), err.reason);
|
||||
this.logger.warning('RPC block rejected: %h (%s).',
|
||||
block.hash(), err.reason);
|
||||
return false;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
|
||||
if (!entry) {
|
||||
this.logger.warning('RPC block rejected: %s (bad-prevblk).',
|
||||
block.rhash());
|
||||
this.logger.warning('RPC block rejected: %h (bad-prevblk).',
|
||||
block.hash());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2414,7 +2414,7 @@ class RPC extends RPCBase {
|
||||
}
|
||||
|
||||
async _addBlock(block) {
|
||||
this.logger.info('Handling submitted block: %s.', block.rhash());
|
||||
this.logger.info('Handling submitted block: %h.', block.hash());
|
||||
|
||||
const prev = await this.chain.getEntry(block.prevBlock);
|
||||
|
||||
@ -2444,16 +2444,16 @@ class RPC extends RPCBase {
|
||||
entry = await this.chain._add(block);
|
||||
} catch (err) {
|
||||
if (err.type === 'VerifyError') {
|
||||
this.logger.warning('RPC block rejected: %s (%s).',
|
||||
block.rhash(), err.reason);
|
||||
this.logger.warning('RPC block rejected: %h (%s).',
|
||||
block.hash(), err.reason);
|
||||
return `rejected: ${err.reason}`;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
|
||||
if (!entry) {
|
||||
this.logger.warning('RPC block rejected: %s (bad-prevblk).',
|
||||
block.rhash());
|
||||
this.logger.warning('RPC block rejected: %h (bad-prevblk).',
|
||||
block.hash());
|
||||
return 'rejected: bad-prevblk';
|
||||
}
|
||||
|
||||
|
||||
@ -1068,11 +1068,11 @@ class TXDB {
|
||||
async removeConflict(wtx) {
|
||||
const tx = wtx.tx;
|
||||
|
||||
this.logger.warning('Handling conflicting tx: %s.', tx.txid());
|
||||
this.logger.warning('Handling conflicting tx: %h.', tx.hash());
|
||||
|
||||
const details = await this.removeRecursive(wtx);
|
||||
|
||||
this.logger.warning('Removed conflict: %s.', tx.txid());
|
||||
this.logger.warning('Removed conflict: %h.', tx.hash());
|
||||
|
||||
// Emit the _removed_ transaction.
|
||||
this.emit('conflict', tx, details);
|
||||
@ -2022,8 +2022,8 @@ class TXDB {
|
||||
|
||||
assert(now - wtx.mtime >= age);
|
||||
|
||||
this.logger.debug('Zapping TX: %s (%d)',
|
||||
wtx.tx.txid(), this.wid);
|
||||
this.logger.debug('Zapping TX: %h (%d)',
|
||||
wtx.tx.hash(), this.wid);
|
||||
|
||||
await this.remove(wtx.hash);
|
||||
|
||||
|
||||
@ -1335,7 +1335,7 @@ class Wallet extends EventEmitter {
|
||||
|
||||
await this.wdb.addTX(tx);
|
||||
|
||||
this.logger.debug('Sending wallet tx (%s): %s', this.id, tx.txid());
|
||||
this.logger.debug('Sending wallet tx (%s): %h', this.id, tx.hash());
|
||||
|
||||
await this.wdb.send(tx);
|
||||
|
||||
@ -1436,8 +1436,8 @@ class Wallet extends EventEmitter {
|
||||
const ntx = mtx.toTX();
|
||||
|
||||
this.logger.debug(
|
||||
'Increasing fee for wallet tx (%s): %s',
|
||||
this.id, ntx.txid());
|
||||
'Increasing fee for wallet tx (%s): %h',
|
||||
this.id, ntx.hash());
|
||||
|
||||
await this.wdb.addTX(ntx);
|
||||
await this.wdb.send(ntx);
|
||||
|
||||
@ -1985,8 +1985,8 @@ class WalletDB extends EventEmitter {
|
||||
}
|
||||
|
||||
if (total > 0) {
|
||||
this.logger.info('Connected WalletDB block %s (tx=%d).',
|
||||
util.revHex(tip.hash), total);
|
||||
this.logger.info('Connected WalletDB block %h (tx=%d).',
|
||||
tip.hash, total);
|
||||
}
|
||||
|
||||
return total;
|
||||
@ -2053,8 +2053,8 @@ class WalletDB extends EventEmitter {
|
||||
// Sync the state to the previous tip.
|
||||
await this.setTip(prev);
|
||||
|
||||
this.logger.warning('Disconnected wallet block %s (tx=%d).',
|
||||
util.revHex(tip.hash), total);
|
||||
this.logger.warning('Disconnected wallet block %h (tx=%d).',
|
||||
tip.hash, total);
|
||||
|
||||
return total;
|
||||
}
|
||||
@ -2123,8 +2123,8 @@ class WalletDB extends EventEmitter {
|
||||
await this.markState(block);
|
||||
|
||||
this.logger.info(
|
||||
'Incoming transaction for %d wallets in WalletDB (%s).',
|
||||
wids.size, tx.txid());
|
||||
'Incoming transaction for %d wallets in WalletDB (%h).',
|
||||
wids.size, tx.hash());
|
||||
|
||||
let result = false;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user