allow usage of the original non-spv pre BIP-37 satoshi protocol.
This commit is contained in:
parent
f4dbc0ee33
commit
7de6964628
@ -161,6 +161,7 @@ Peer.prototype.broadcast = function broadcast(items) {
|
||||
};
|
||||
|
||||
Peer.prototype.updateWatch = function updateWatch() {
|
||||
if (this.options.satoshi) return;
|
||||
if (this.ack)
|
||||
this._write(this.framer.filterLoad(this.bloom, 'none'));
|
||||
};
|
||||
@ -417,6 +418,13 @@ Peer.prototype._handleInv = function handleInv(items) {
|
||||
});
|
||||
this.emit('blocks', blocks);
|
||||
|
||||
if (this.options.satoshi) {
|
||||
this.getData(items.filter(function(item) {
|
||||
return item.type === 'block';
|
||||
}));
|
||||
return;
|
||||
}
|
||||
|
||||
if (txs.length === 0)
|
||||
return;
|
||||
|
||||
|
||||
@ -105,7 +105,8 @@ Pool.prototype._addLoader = function _addLoader() {
|
||||
return;
|
||||
|
||||
var peer = new bcoin.peer(this, this.createConnection, {
|
||||
backoff: 750 * Math.random()
|
||||
backoff: 750 * Math.random(),
|
||||
satoshi: this.options.satoshi
|
||||
});
|
||||
this.peers.load = peer;
|
||||
|
||||
@ -242,7 +243,8 @@ Pool.prototype._addPeer = function _addPeer(backoff) {
|
||||
return;
|
||||
|
||||
var peer = new bcoin.peer(this, this.createConnection, {
|
||||
backoff: backoff
|
||||
backoff: backoff,
|
||||
satoshi: this.options.satoshi
|
||||
});
|
||||
|
||||
this.peers.pending.push(peer);
|
||||
@ -293,9 +295,11 @@ Pool.prototype._addPeer = function _addPeer(backoff) {
|
||||
self.emit('block', block, peer);
|
||||
});
|
||||
|
||||
peer.on('block', function(block) {
|
||||
self.emit('block', block, peer);
|
||||
});
|
||||
if (this.options.satoshi) {
|
||||
peer.on('block', function(block) {
|
||||
self.emit('block', block, peer);
|
||||
});
|
||||
}
|
||||
|
||||
// Just FYI
|
||||
peer.on('reject', function(payload) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user