check for fullNode in handleBlock and handleMerkle.
This commit is contained in:
parent
1be3a74c70
commit
8b546a85e0
@ -320,6 +320,9 @@ Pool.prototype._addLoader = function _addLoader() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Pool.prototype._handleMerkle = function _handleMerkle(block, peer) {
|
Pool.prototype._handleMerkle = function _handleMerkle(block, peer) {
|
||||||
|
if (this.options.fullNode)
|
||||||
|
return;
|
||||||
|
|
||||||
this._response(block);
|
this._response(block);
|
||||||
this.chain.add(block);
|
this.chain.add(block);
|
||||||
this.emit('chain-progress', this.chain.fillPercent(), peer);
|
this.emit('chain-progress', this.chain.fillPercent(), peer);
|
||||||
@ -330,6 +333,9 @@ Pool.prototype._handleBlock = function _handleBlock(block, peer) {
|
|||||||
var self = this;
|
var self = this;
|
||||||
var hash, size, orphan, err;
|
var hash, size, orphan, err;
|
||||||
|
|
||||||
|
if (!this.options.fullNode)
|
||||||
|
return;
|
||||||
|
|
||||||
if (this.listeners('watched').length > 0) {
|
if (this.listeners('watched').length > 0) {
|
||||||
utils.nextTick(function() {
|
utils.nextTick(function() {
|
||||||
block.txs.forEach(function(tx) {
|
block.txs.forEach(function(tx) {
|
||||||
@ -497,19 +503,17 @@ Pool.prototype._addPeer = function _addPeer(backoff) {
|
|||||||
self._scheduleRequests();
|
self._scheduleRequests();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!this.options.fullNode) {
|
peer.on('merkleblock', function(block) {
|
||||||
peer.on('merkleblock', function(block) {
|
// Reset backoff, peer seems to be responsive
|
||||||
// Reset backoff, peer seems to be responsive
|
backoff = 0;
|
||||||
backoff = 0;
|
self._handleMerkle(block, peer);
|
||||||
self._handleMerkle(block, peer);
|
});
|
||||||
});
|
|
||||||
} else {
|
peer.on('block', function(block) {
|
||||||
peer.on('block', function(block) {
|
// Reset backoff, peer seems to be responsive
|
||||||
// Reset backoff, peer seems to be responsive
|
backoff = 0;
|
||||||
backoff = 0;
|
self._handleBlock(block, peer);
|
||||||
self._handleBlock(block, peer);
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Just FYI
|
// Just FYI
|
||||||
peer.on('reject', function(payload) {
|
peer.on('reject', function(payload) {
|
||||||
@ -720,13 +724,13 @@ Pool.prototype.addWallet = function addWallet(w, defaultTs) {
|
|||||||
self.sendTX(tx);
|
self.sendTX(tx);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (self.options.fullNode)
|
||||||
|
return;
|
||||||
|
|
||||||
// Search for last week by default
|
// Search for last week by default
|
||||||
if (!ts)
|
if (!ts)
|
||||||
ts = defaultTs || ((+new Date / 1000) - 7 * 24 * 3600);
|
ts = defaultTs || ((+new Date / 1000) - 7 * 24 * 3600);
|
||||||
|
|
||||||
if (self.options.fullNode)
|
|
||||||
return;
|
|
||||||
|
|
||||||
self.search(false, ts, e);
|
self.search(false, ts, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,8 +814,7 @@ Pool.prototype.search = function search(id, range, e) {
|
|||||||
self.watch(id);
|
self.watch(id);
|
||||||
|
|
||||||
self._loadRange(hashes, true);
|
self._loadRange(hashes, true);
|
||||||
// XXX
|
|
||||||
// return;
|
|
||||||
hashes = hashes.slice().reverse();
|
hashes = hashes.slice().reverse();
|
||||||
hashes.forEach(function(hash, i) {
|
hashes.forEach(function(hash, i) {
|
||||||
// Get the block that is in index
|
// Get the block that is in index
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user