fix readvarint2. fix memUsage.
This commit is contained in:
parent
26d3003a9d
commit
c71e7646d3
@ -1729,7 +1729,7 @@ Mempool.prototype.memUsageBitcoind = function memUsageBitcoind(tx) {
|
|||||||
input = tx.inputs[i];
|
input = tx.inputs[i];
|
||||||
mem += mallocUsage(input.witness.items.length);
|
mem += mallocUsage(input.witness.items.length);
|
||||||
for (j = 0; j < input.witness.items.length; j++)
|
for (j = 0; j < input.witness.items.length; j++)
|
||||||
mem += mallocUsage(input.witness[j].items.length);
|
mem += mallocUsage(input.witness.items[j].length);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mem;
|
return mem;
|
||||||
|
|||||||
@ -570,14 +570,14 @@ MinerBlock.prototype.findNonce = function findNonce() {
|
|||||||
MinerBlock.prototype.__defineGetter__('hashes', function() {
|
MinerBlock.prototype.__defineGetter__('hashes', function() {
|
||||||
return new bn(this.iterations)
|
return new bn(this.iterations)
|
||||||
.mul(utils.U32)
|
.mul(utils.U32)
|
||||||
.addn(this.block.nonce);
|
.addn(this.block.nonce | 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
MinerBlock.prototype.__defineGetter__('rate', function() {
|
MinerBlock.prototype.__defineGetter__('rate', function() {
|
||||||
if (!this.block.nonce)
|
if (!this.block.nonce)
|
||||||
return 0;
|
return 0;
|
||||||
// Calculate our terrible hashrate
|
// Calculate our terrible hashrate
|
||||||
return (this.block.nonce / (utils.now() - this.begin)) * 2 | 0;
|
return (this.block.nonce / (utils.now() - this.begin)) | 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1838,6 +1838,7 @@ utils.readVarint2 = function readVarint2(data, off, big) {
|
|||||||
if (num >= 0x3fffffffffff) {
|
if (num >= 0x3fffffffffff) {
|
||||||
assert(big, 'Number exceeds 2^53-1.');
|
assert(big, 'Number exceeds 2^53-1.');
|
||||||
bnum = new bn(num);
|
bnum = new bn(num);
|
||||||
|
num = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bnum) {
|
if (bnum) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user