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