raw blocks. pool fixes.
This commit is contained in:
parent
b98640b27e
commit
5dce1427ba
@ -98,7 +98,7 @@ Block.prototype.hash = function hash(enc) {
|
|||||||
|
|
||||||
Block.prototype.abbr = function abbr() {
|
Block.prototype.abbr = function abbr() {
|
||||||
if (this.network && this._raw)
|
if (this.network && this._raw)
|
||||||
return this._raw.slice();
|
return this._raw.slice(0, 80);
|
||||||
|
|
||||||
var res = new Array(80);
|
var res = new Array(80);
|
||||||
utils.write32(res, this.version, 0);
|
utils.write32(res, this.version, 0);
|
||||||
@ -123,6 +123,8 @@ Block.verify = function verify(data, subtype) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Block.prototype.render = function render() {
|
Block.prototype.render = function render() {
|
||||||
|
if (this.network && this._raw && this._raw.length > 80)
|
||||||
|
return this._raw;
|
||||||
return bcoin.protocol.framer.block(this, this.subtype);
|
return bcoin.protocol.framer.block(this, this.subtype);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -333,6 +333,14 @@ Pool.prototype._addLoader = function _addLoader() {
|
|||||||
if (this.peers.load != null)
|
if (this.peers.load != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!this.options.headers && !this.options.multiplePeers) {
|
||||||
|
this.request = {
|
||||||
|
map: {},
|
||||||
|
active: 0,
|
||||||
|
queue: []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
peer = this._createPeer(750 * Math.random(), true);
|
peer = this._createPeer(750 * Math.random(), true);
|
||||||
|
|
||||||
peer.once('socket', function() {
|
peer.once('socket', function() {
|
||||||
@ -1609,7 +1617,7 @@ Pool.prototype.usableSeed = function usableSeed(priority, connecting) {
|
|||||||
// If we have no block peers, always return
|
// If we have no block peers, always return
|
||||||
// an address.
|
// an address.
|
||||||
if (!priority) {
|
if (!priority) {
|
||||||
if (all.length === 1)
|
if (all.length === 1 || connecting)
|
||||||
return all[Math.random() * (all.length - 1) | 0];
|
return all[Math.random() * (all.length - 1) | 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -353,7 +353,7 @@ Parser.prototype.parseBlock = function parseBlock(p) {
|
|||||||
nonce: utils.readU32(p, 76),
|
nonce: utils.readU32(p, 76),
|
||||||
totalTX: totalTX,
|
totalTX: totalTX,
|
||||||
txs: txs,
|
txs: txs,
|
||||||
_raw: p.slice(0, 80),
|
_raw: p,
|
||||||
_size: p.length
|
_size: p.length
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user