remove multiplePeers option.
This commit is contained in:
parent
c0bb66bf73
commit
9bc0b250ae
@ -44,7 +44,6 @@ function Pool(options) {
|
||||
options.spv = false;
|
||||
|
||||
options.headers = options.headers;
|
||||
options.multiplePeers = options.multiplePeers;
|
||||
options.relay = options.relay == null
|
||||
? (!options.spv ? true : false)
|
||||
: options.relay;
|
||||
@ -62,18 +61,11 @@ function Pool(options) {
|
||||
if (options.spv) {
|
||||
if (options.headers == null)
|
||||
options.headers = true;
|
||||
if (options.multiplePeers == null)
|
||||
options.multiplePeers = true;
|
||||
} else {
|
||||
if (options.headers == null)
|
||||
options.headers = false;
|
||||
if (options.multiplePeers == null)
|
||||
options.multiplePeers = false;
|
||||
}
|
||||
|
||||
if (!options.headers)
|
||||
options.multiplePeers = false;
|
||||
|
||||
this.syncing = false;
|
||||
this.synced = false;
|
||||
|
||||
@ -86,7 +78,6 @@ function Pool(options) {
|
||||
|
||||
this.chain = new bcoin.chain({
|
||||
spv: options.spv,
|
||||
multiplePeers: options.multiplePeers,
|
||||
preload: options.preload,
|
||||
blockdb: options.blockdb,
|
||||
mempool: options.mempool
|
||||
@ -222,8 +213,7 @@ Pool.prototype._init = function _init() {
|
||||
|
||||
// Increase banscore by 10 if we're using getheaders.
|
||||
if (self.options.headers) {
|
||||
if (!self.options.multiplePeers)
|
||||
self.setMisbehavior(peer, 10);
|
||||
self.setMisbehavior(peer, 10);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -523,7 +513,7 @@ Pool.prototype.stopSync = function stopSync() {
|
||||
|
||||
Pool.prototype._handleHeaders = function _handleHeaders(headers, peer) {
|
||||
var self = this;
|
||||
var i, header, last, block, blockPeer;
|
||||
var i, header, last, block;
|
||||
|
||||
assert(this.options.headers);
|
||||
|
||||
@ -545,15 +535,6 @@ Pool.prototype._handleHeaders = function _handleHeaders(headers, peer) {
|
||||
this.chain.onFlush(function() {
|
||||
for (i = 0; i < headers.length; i++) {
|
||||
block = bcoin.block(headers[i], 'header');
|
||||
blockPeer = peer;
|
||||
|
||||
// if (self.options.multiplePeers) {
|
||||
// if (self.peers.regular.length) {
|
||||
// blockPeer = self.peers.regular[i % (self.peers.regular.length + 1)];
|
||||
// if (!blockPeer)
|
||||
// blockPeer = self.peers.load;
|
||||
// }
|
||||
// }
|
||||
|
||||
if (last && block.prevBlock !== last.hash('hex'))
|
||||
break;
|
||||
@ -562,7 +543,7 @@ Pool.prototype._handleHeaders = function _handleHeaders(headers, peer) {
|
||||
break;
|
||||
|
||||
if (!self.chain.has(block))
|
||||
self.getData(blockPeer, self.block.type, block.hash('hex'));
|
||||
self.getData(peer, self.block.type, block.hash('hex'));
|
||||
|
||||
last = block;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user