pool: minor.
This commit is contained in:
parent
7791f7b21d
commit
ab94bf07b3
@ -129,7 +129,7 @@ function Pool(options) {
|
|||||||
this.syncing = false;
|
this.syncing = false;
|
||||||
this.synced = false;
|
this.synced = false;
|
||||||
this._scheduled = false;
|
this._scheduled = false;
|
||||||
this._pendingWatch = false;
|
this._pendingWatch = null;
|
||||||
|
|
||||||
this.load = {
|
this.load = {
|
||||||
timeout: options.loadTimeout || 120000,
|
timeout: options.loadTimeout || 120000,
|
||||||
@ -888,7 +888,8 @@ Pool.prototype._createPeer = function _createPeer(options) {
|
|||||||
network: options.network,
|
network: options.network,
|
||||||
spv: options.spv,
|
spv: options.spv,
|
||||||
witness: options.witness,
|
witness: options.witness,
|
||||||
headers: this.options.headers
|
headers: this.options.headers,
|
||||||
|
ts: options.ts
|
||||||
});
|
});
|
||||||
|
|
||||||
peer.on('error', function(err) {
|
peer.on('error', function(err) {
|
||||||
@ -1045,7 +1046,7 @@ Pool.prototype._handleTX = function _handleTX(tx, peer, callback) {
|
|||||||
// Fulfill the load request.
|
// Fulfill the load request.
|
||||||
requested = this.fulfill(tx);
|
requested = this.fulfill(tx);
|
||||||
|
|
||||||
if (!requested && tx.ts === 0) {
|
if (!requested) {
|
||||||
peer.invFilter.add(tx.hash());
|
peer.invFilter.add(tx.hash());
|
||||||
|
|
||||||
if (!this.mempool)
|
if (!this.mempool)
|
||||||
@ -1062,17 +1063,12 @@ Pool.prototype._handleTX = function _handleTX(tx, peer, callback) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addMempool(tx, callback) {
|
if (!self.mempool) {
|
||||||
if (!self.mempool)
|
self.emit('tx', tx, peer);
|
||||||
return utils.nextTick(callback);
|
return callback();
|
||||||
|
|
||||||
if (tx.ts !== 0)
|
|
||||||
return utils.nextTick(callback);
|
|
||||||
|
|
||||||
self.mempool.addTX(tx, callback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addMempool(tx, function(err) {
|
self.mempool.addTX(tx, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err.type === 'VerifyError') {
|
if (err.type === 'VerifyError') {
|
||||||
if (err.score !== -1)
|
if (err.score !== -1)
|
||||||
@ -1256,13 +1252,11 @@ Pool.prototype.updateWatch = function updateWatch() {
|
|||||||
var self = this;
|
var self = this;
|
||||||
var i;
|
var i;
|
||||||
|
|
||||||
if (this._pendingWatch)
|
if (this._pendingWatch != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._pendingWatch = true;
|
this._pendingWatch = setTimeout(function() {
|
||||||
|
self._pendingWatch = null;
|
||||||
setTimeout(function() {
|
|
||||||
self._pendingWatch = false;
|
|
||||||
|
|
||||||
if (self.peers.load)
|
if (self.peers.load)
|
||||||
self.peers.load.updateWatch();
|
self.peers.load.updateWatch();
|
||||||
@ -1681,7 +1675,7 @@ Pool.prototype.fillCoins = function fillCoins(tx, callback) {
|
|||||||
Pool.prototype.getLoaderHost = function getLoaderHost() {
|
Pool.prototype.getLoaderHost = function getLoaderHost() {
|
||||||
var host;
|
var host;
|
||||||
|
|
||||||
if (!this.connected)
|
if (!this.connected && process.env.BCOIN_SEED)
|
||||||
return this.seeds[0];
|
return this.seeds[0];
|
||||||
|
|
||||||
host = this.getRandom(this.seeds);
|
host = this.getRandom(this.seeds);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user