fix readvarint2. fix memUsage.

This commit is contained in:
Christopher Jeffrey 2016-05-22 17:33:38 -07:00
parent 26d3003a9d
commit c71e7646d3
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
3 changed files with 4 additions and 3 deletions

View File

@ -1729,7 +1729,7 @@ Mempool.prototype.memUsageBitcoind = function memUsageBitcoind(tx) {
input = tx.inputs[i];
mem += mallocUsage(input.witness.items.length);
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;

View File

@ -570,14 +570,14 @@ MinerBlock.prototype.findNonce = function findNonce() {
MinerBlock.prototype.__defineGetter__('hashes', function() {
return new bn(this.iterations)
.mul(utils.U32)
.addn(this.block.nonce);
.addn(this.block.nonce | 0);
});
MinerBlock.prototype.__defineGetter__('rate', function() {
if (!this.block.nonce)
return 0;
// Calculate our terrible hashrate
return (this.block.nonce / (utils.now() - this.begin)) * 2 | 0;
return (this.block.nonce / (utils.now() - this.begin)) | 0;
});
/**

View File

@ -1838,6 +1838,7 @@ utils.readVarint2 = function readVarint2(data, off, big) {
if (num >= 0x3fffffffffff) {
assert(big, 'Number exceeds 2^53-1.');
bnum = new bn(num);
num = 0;
}
if (bnum) {