style consistency - again.

This commit is contained in:
Christopher Jeffrey 2015-12-19 02:05:46 -08:00
parent 6411ec8914
commit 1a6633bade
3 changed files with 8 additions and 6 deletions

View File

@ -385,6 +385,7 @@ Framer.prototype.merkleBlock = function merkleBlock(block) {
Framer.prototype.addr = function addr(peers) {
var p = [];
var i = 0;
var off = 0;
var peer;
var start = (Date.now() / 1000 | 0) - process.uptime();
@ -393,7 +394,7 @@ Framer.prototype.addr = function addr(peers) {
// count
off += varint(p, peers.length, off);
for (i = 0; i < peers.length; i++) {
for (; i < peers.length; i++) {
peer = peers[i];
// timestamp

View File

@ -206,8 +206,7 @@ function readIntv(p, off) {
Parser.prototype.parseInvList = function parseInvList(p) {
var items = [];
var off = 0;
var i, count;
var i, off, count;
count = readIntv(p, 0);
p = p.slice(count.off);
@ -216,7 +215,7 @@ Parser.prototype.parseInvList = function parseInvList(p) {
if (p.length < count * 36)
return this._error('Invalid getdata size');
for (i = 0; i < count; i++, off += 36) {
for (i = 0, off = 0; i < count; i++, off += 36) {
items.push({
type: constants.invByVal[readU32(p, off)],
hash: p.slice(off + 4, off + 36)
@ -386,7 +385,7 @@ Parser.prototype.parseTXOut = function parseTXOut(p) {
Parser.prototype.parseTX = function parseTX(p) {
var inCount, off, txIn, tx;
var outCount, off, txOut;
var outCount, txOut;
var i;
if (p.length < 10)

View File

@ -429,12 +429,14 @@ function bitsToTarget(bits) {
utils.bitsToTarget = bitsToTarget;
function testTarget(target, hash) {
var i;
if (typeof target === 'number')
target = bitsToTarget(target);
hash = utils.toArray(hash, 'hex');
for (var i = hash.length - 1; i >= target.length; i--)
for (i = hash.length - 1; i >= target.length; i--)
if (hash[i] !== 0)
return false;