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