From 3c3f6b953c822b23a7678eface16e5168933d71c Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sat, 4 Nov 2017 11:39:00 -0700 Subject: [PATCH] network/fees: minor. --- lib/mempool/fees.js | 2 +- lib/primitives/mtx.js | 12 ++++++------ lib/protocol/network.js | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/mempool/fees.js b/lib/mempool/fees.js index 4adab84c..c7f2c6ab 100644 --- a/lib/mempool/fees.js +++ b/lib/mempool/fees.js @@ -861,8 +861,8 @@ DoubleMap.prototype.insert = function insert(key, value) { }; DoubleMap.prototype.search = function search(key) { - const i = binary.search(this.buckets, key, compare, true); assert(this.buckets.length !== 0, 'Cannot search.'); + const i = binary.search(this.buckets, key, compare, true); return this.buckets[i][1]; }; diff --git a/lib/primitives/mtx.js b/lib/primitives/mtx.js index 699e3e31..32c0247e 100644 --- a/lib/primitives/mtx.js +++ b/lib/primitives/mtx.js @@ -792,7 +792,7 @@ MTX.prototype.signVector = function signVector(prev, vector, sig, ring) { for (let i = 1; i < vector.length; i++) { const item = vector.get(i); if (item.length > 0) - total++; + total += 1; } // Signatures are already finalized. @@ -833,7 +833,7 @@ MTX.prototype.signVector = function signVector(prev, vector, sig, ring) { // Offset key index by one to turn it into // "sig index". Accounts for OP_0 byte at // the start. - keyIndex++; + keyIndex += 1; // Add our signature to the correct slot // and increment the total number of @@ -841,7 +841,7 @@ MTX.prototype.signVector = function signVector(prev, vector, sig, ring) { if (keyIndex < vector.length && total < m) { if (vector.get(keyIndex).length === 0) { vector.set(keyIndex, sig); - total++; + total += 1; } } @@ -858,7 +858,7 @@ MTX.prototype.signVector = function signVector(prev, vector, sig, ring) { // This should never happen. while (total > m) { vector.pop(); - total--; + total -= 1; } // Sanity checks. @@ -1026,7 +1026,7 @@ MTX.prototype.template = function template(ring) { if (!this.scriptInput(i, coin, ring)) continue; - total++; + total += 1; } return total; @@ -1070,7 +1070,7 @@ MTX.prototype.sign = function sign(ring, type) { if (!this.signInput(i, coin, ring, type)) continue; - total++; + total += 1; } return total; diff --git a/lib/protocol/network.js b/lib/protocol/network.js index 99ce524a..412bc303 100644 --- a/lib/protocol/network.js +++ b/lib/protocol/network.js @@ -97,13 +97,13 @@ Network.prototype.init = function init() { bits |= consensus.VERSION_TOP_MASK; - this.unknownBits = ~bits; + this.unknownBits = ~bits >>> 0; for (const key of Object.keys(this.checkpointMap)) { const hash = this.checkpointMap[key]; const height = Number(key); - this.checkpoints.push({ hash: hash, height: height }); + this.checkpoints.push({ hash, height }); } this.checkpoints.sort(cmpNode);