Skip to content

Commit

Permalink
network/fees: minor.
Browse files Browse the repository at this point in the history
  • Loading branch information
chjj committed Mar 30, 2018
1 parent 8dbf7e8 commit 3c3f6b9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/mempool/fees.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
};

Expand Down
12 changes: 6 additions & 6 deletions lib/primitives/mtx.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -833,15 +833,15 @@ 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
// signatures.
if (keyIndex < vector.length && total < m) {
if (vector.get(keyIndex).length === 0) {
vector.set(keyIndex, sig);
total++;
total += 1;
}
}

Expand All @@ -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.
Expand Down Expand Up @@ -1026,7 +1026,7 @@ MTX.prototype.template = function template(ring) {
if (!this.scriptInput(i, coin, ring))
continue;

total++;
total += 1;
}

return total;
Expand Down Expand Up @@ -1070,7 +1070,7 @@ MTX.prototype.sign = function sign(ring, type) {
if (!this.signInput(i, coin, ring, type))
continue;

total++;
total += 1;
}

return total;
Expand Down
4 changes: 2 additions & 2 deletions lib/protocol/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3c3f6b9

Please sign in to comment.