network/fees: minor.
This commit is contained in:
parent
8dbf7e8ba2
commit
3c3f6b953c
@ -861,8 +861,8 @@ DoubleMap.prototype.insert = function insert(key, value) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
DoubleMap.prototype.search = function search(key) {
|
DoubleMap.prototype.search = function search(key) {
|
||||||
const i = binary.search(this.buckets, key, compare, true);
|
|
||||||
assert(this.buckets.length !== 0, 'Cannot search.');
|
assert(this.buckets.length !== 0, 'Cannot search.');
|
||||||
|
const i = binary.search(this.buckets, key, compare, true);
|
||||||
return this.buckets[i][1];
|
return this.buckets[i][1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -792,7 +792,7 @@ MTX.prototype.signVector = function signVector(prev, vector, sig, ring) {
|
|||||||
for (let i = 1; i < vector.length; i++) {
|
for (let i = 1; i < vector.length; i++) {
|
||||||
const item = vector.get(i);
|
const item = vector.get(i);
|
||||||
if (item.length > 0)
|
if (item.length > 0)
|
||||||
total++;
|
total += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Signatures are already finalized.
|
// 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
|
// Offset key index by one to turn it into
|
||||||
// "sig index". Accounts for OP_0 byte at
|
// "sig index". Accounts for OP_0 byte at
|
||||||
// the start.
|
// the start.
|
||||||
keyIndex++;
|
keyIndex += 1;
|
||||||
|
|
||||||
// Add our signature to the correct slot
|
// Add our signature to the correct slot
|
||||||
// and increment the total number of
|
// 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 (keyIndex < vector.length && total < m) {
|
||||||
if (vector.get(keyIndex).length === 0) {
|
if (vector.get(keyIndex).length === 0) {
|
||||||
vector.set(keyIndex, sig);
|
vector.set(keyIndex, sig);
|
||||||
total++;
|
total += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -858,7 +858,7 @@ MTX.prototype.signVector = function signVector(prev, vector, sig, ring) {
|
|||||||
// This should never happen.
|
// This should never happen.
|
||||||
while (total > m) {
|
while (total > m) {
|
||||||
vector.pop();
|
vector.pop();
|
||||||
total--;
|
total -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sanity checks.
|
// Sanity checks.
|
||||||
@ -1026,7 +1026,7 @@ MTX.prototype.template = function template(ring) {
|
|||||||
if (!this.scriptInput(i, coin, ring))
|
if (!this.scriptInput(i, coin, ring))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
total++;
|
total += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
@ -1070,7 +1070,7 @@ MTX.prototype.sign = function sign(ring, type) {
|
|||||||
if (!this.signInput(i, coin, ring, type))
|
if (!this.signInput(i, coin, ring, type))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
total++;
|
total += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
|
|||||||
@ -97,13 +97,13 @@ Network.prototype.init = function init() {
|
|||||||
|
|
||||||
bits |= consensus.VERSION_TOP_MASK;
|
bits |= consensus.VERSION_TOP_MASK;
|
||||||
|
|
||||||
this.unknownBits = ~bits;
|
this.unknownBits = ~bits >>> 0;
|
||||||
|
|
||||||
for (const key of Object.keys(this.checkpointMap)) {
|
for (const key of Object.keys(this.checkpointMap)) {
|
||||||
const hash = this.checkpointMap[key];
|
const hash = this.checkpointMap[key];
|
||||||
const height = Number(key);
|
const height = Number(key);
|
||||||
|
|
||||||
this.checkpoints.push({ hash: hash, height: height });
|
this.checkpoints.push({ hash, height });
|
||||||
}
|
}
|
||||||
|
|
||||||
this.checkpoints.sort(cmpNode);
|
this.checkpoints.sort(cmpNode);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user