style consistency - again.
This commit is contained in:
parent
6411ec8914
commit
1a6633bade
@ -385,6 +385,7 @@ Framer.prototype.merkleBlock = function merkleBlock(block) {
|
|||||||
|
|
||||||
Framer.prototype.addr = function addr(peers) {
|
Framer.prototype.addr = function addr(peers) {
|
||||||
var p = [];
|
var p = [];
|
||||||
|
var i = 0;
|
||||||
var off = 0;
|
var off = 0;
|
||||||
var peer;
|
var peer;
|
||||||
var start = (Date.now() / 1000 | 0) - process.uptime();
|
var start = (Date.now() / 1000 | 0) - process.uptime();
|
||||||
@ -393,7 +394,7 @@ Framer.prototype.addr = function addr(peers) {
|
|||||||
// count
|
// count
|
||||||
off += varint(p, peers.length, off);
|
off += varint(p, peers.length, off);
|
||||||
|
|
||||||
for (i = 0; i < peers.length; i++) {
|
for (; i < peers.length; i++) {
|
||||||
peer = peers[i];
|
peer = peers[i];
|
||||||
|
|
||||||
// timestamp
|
// timestamp
|
||||||
|
|||||||
@ -206,8 +206,7 @@ function readIntv(p, off) {
|
|||||||
|
|
||||||
Parser.prototype.parseInvList = function parseInvList(p) {
|
Parser.prototype.parseInvList = function parseInvList(p) {
|
||||||
var items = [];
|
var items = [];
|
||||||
var off = 0;
|
var i, off, count;
|
||||||
var i, count;
|
|
||||||
|
|
||||||
count = readIntv(p, 0);
|
count = readIntv(p, 0);
|
||||||
p = p.slice(count.off);
|
p = p.slice(count.off);
|
||||||
@ -216,7 +215,7 @@ Parser.prototype.parseInvList = function parseInvList(p) {
|
|||||||
if (p.length < count * 36)
|
if (p.length < count * 36)
|
||||||
return this._error('Invalid getdata size');
|
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({
|
items.push({
|
||||||
type: constants.invByVal[readU32(p, off)],
|
type: constants.invByVal[readU32(p, off)],
|
||||||
hash: p.slice(off + 4, off + 36)
|
hash: p.slice(off + 4, off + 36)
|
||||||
@ -386,7 +385,7 @@ Parser.prototype.parseTXOut = function parseTXOut(p) {
|
|||||||
|
|
||||||
Parser.prototype.parseTX = function parseTX(p) {
|
Parser.prototype.parseTX = function parseTX(p) {
|
||||||
var inCount, off, txIn, tx;
|
var inCount, off, txIn, tx;
|
||||||
var outCount, off, txOut;
|
var outCount, txOut;
|
||||||
var i;
|
var i;
|
||||||
|
|
||||||
if (p.length < 10)
|
if (p.length < 10)
|
||||||
|
|||||||
@ -429,12 +429,14 @@ function bitsToTarget(bits) {
|
|||||||
utils.bitsToTarget = bitsToTarget;
|
utils.bitsToTarget = bitsToTarget;
|
||||||
|
|
||||||
function testTarget(target, hash) {
|
function testTarget(target, hash) {
|
||||||
|
var i;
|
||||||
|
|
||||||
if (typeof target === 'number')
|
if (typeof target === 'number')
|
||||||
target = bitsToTarget(target);
|
target = bitsToTarget(target);
|
||||||
|
|
||||||
hash = utils.toArray(hash, 'hex');
|
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)
|
if (hash[i] !== 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user