minor improvements and fixes.
This commit is contained in:
parent
afcb89f76f
commit
43b0533a18
@ -307,10 +307,13 @@ Block.prototype.getReward = function getReward() {
|
|||||||
if (this._reward)
|
if (this._reward)
|
||||||
return this._reward;
|
return this._reward;
|
||||||
|
|
||||||
|
base = Block.reward(this.height);
|
||||||
|
|
||||||
if (this.txs.length === 0 || !this.txs[0].isCoinbase()) {
|
if (this.txs.length === 0 || !this.txs[0].isCoinbase()) {
|
||||||
return this._reward = {
|
return this._reward = {
|
||||||
fee: new bn(0),
|
fee: new bn(0),
|
||||||
reward: Block.reward(this.height)
|
reward: base,
|
||||||
|
base: base
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,8 +322,6 @@ Block.prototype.getReward = function getReward() {
|
|||||||
return total;
|
return total;
|
||||||
}, new bn(0));
|
}, new bn(0));
|
||||||
|
|
||||||
base = Block.reward(this.height);
|
|
||||||
|
|
||||||
// If height is not accurate, artificially increase
|
// If height is not accurate, artificially increase
|
||||||
// the reward era until base is smaller than the reward.
|
// the reward era until base is smaller than the reward.
|
||||||
height = 0;
|
height = 0;
|
||||||
@ -333,7 +334,8 @@ Block.prototype.getReward = function getReward() {
|
|||||||
|
|
||||||
return this._reward = {
|
return this._reward = {
|
||||||
fee: fee,
|
fee: fee,
|
||||||
reward: reward
|
reward: reward,
|
||||||
|
base: base
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -371,6 +373,7 @@ Block.prototype.inspect = function inspect() {
|
|||||||
copy.nextBlock = this.nextBlock;
|
copy.nextBlock = this.nextBlock;
|
||||||
copy.reward = utils.btc(this.reward);
|
copy.reward = utils.btc(this.reward);
|
||||||
copy.fee = utils.btc(this.fee);
|
copy.fee = utils.btc(this.fee);
|
||||||
|
copy.date = new Date((copy.ts || 0) * 1000).toISOString();
|
||||||
return copy;
|
return copy;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -105,7 +105,7 @@ Input.prototype.__defineGetter__('m', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Input.prototype.__defineGetter__('n', function() {
|
Input.prototype.__defineGetter__('n', function() {
|
||||||
return this.data.n || this.data.m;
|
return this.data.n || this.m;
|
||||||
});
|
});
|
||||||
|
|
||||||
Input.prototype.__defineGetter__('lock', function() {
|
Input.prototype.__defineGetter__('lock', function() {
|
||||||
|
|||||||
@ -89,7 +89,7 @@ Output.prototype.__defineGetter__('m', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Output.prototype.__defineGetter__('n', function() {
|
Output.prototype.__defineGetter__('n', function() {
|
||||||
return this.data.n || this.data.m;
|
return this.data.n || this.m;
|
||||||
});
|
});
|
||||||
|
|
||||||
Output.prototype.__defineGetter__('lock', function() {
|
Output.prototype.__defineGetter__('lock', function() {
|
||||||
|
|||||||
@ -569,10 +569,11 @@ Pool.prototype.watch = function watch(id) {
|
|||||||
Pool.prototype.unwatch = function unwatch(id) {
|
Pool.prototype.unwatch = function unwatch(id) {
|
||||||
var i;
|
var i;
|
||||||
|
|
||||||
|
id = utils.toHex(id);
|
||||||
|
|
||||||
if (!this.bloom.test(id, 'hex'))
|
if (!this.bloom.test(id, 'hex'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
id = utils.toHex(id);
|
|
||||||
if (!this.watchMap[id] || --this.watchMap[id] !== 0)
|
if (!this.watchMap[id] || --this.watchMap[id] !== 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@ -123,11 +123,12 @@ Framer.prototype.verack = function verack() {
|
|||||||
|
|
||||||
Framer.prototype._inv = function _inv(command, items) {
|
Framer.prototype._inv = function _inv(command, items) {
|
||||||
var res = [];
|
var res = [];
|
||||||
var off = utils.writeIntv(res, items.length, 0);
|
var off, i, hash;
|
||||||
var i, hash;
|
|
||||||
|
|
||||||
assert(items.length <= 50000);
|
assert(items.length <= 50000);
|
||||||
|
|
||||||
|
off = utils.writeIntv(res, items.length, 0);
|
||||||
|
|
||||||
for (i = 0; i < items.length; i++) {
|
for (i = 0; i < items.length; i++) {
|
||||||
// Type
|
// Type
|
||||||
off += writeU32(res, constants.inv[items[i].type], off);
|
off += writeU32(res, constants.inv[items[i].type], off);
|
||||||
|
|||||||
@ -914,6 +914,7 @@ TX.prototype.inspect = function inspect() {
|
|||||||
copy.fee = utils.btc(this.fee);
|
copy.fee = utils.btc(this.fee);
|
||||||
copy.height = this.height;
|
copy.height = this.height;
|
||||||
copy.confirmations = this.confirmations;
|
copy.confirmations = this.confirmations;
|
||||||
|
copy.date = new Date((copy.ts || 0) * 1000).toISOString();
|
||||||
return copy;
|
return copy;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -595,6 +595,7 @@ utils.toBTC = function toBTC(satoshi, strict) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
utils.satoshi =
|
utils.satoshi =
|
||||||
|
utils.toSatoshi =
|
||||||
utils.fromBTC = function fromBTC(btc, strict) {
|
utils.fromBTC = function fromBTC(btc, strict) {
|
||||||
var satoshi, parts, hi, lo;
|
var satoshi, parts, hi, lo;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user