fix banning in certain cases.

This commit is contained in:
Christopher Jeffrey 2016-05-25 03:15:00 -07:00
parent 77d7916f1e
commit f065179d69
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 5 additions and 4 deletions

View File

@ -184,7 +184,7 @@ Peer.prototype._init = function init() {
this.parser.on('error', function(err) {
self.sendReject(null, 'malformed', 'error parsing message', 10);
self._error(err);
self._error(err, true);
});
this.request('verack', function callee(err) {
@ -527,7 +527,7 @@ Peer.prototype.write = function write(chunk) {
* @param {String|Error} err
*/
Peer.prototype._error = function error(err) {
Peer.prototype._error = function error(err, keep) {
if (this.destroyed)
return;
@ -536,7 +536,9 @@ Peer.prototype._error = function error(err) {
err.message += ' (' + this.hostname + ')';
this.destroy();
if (!keep)
this.destroy();
this.emit('error', err);
};

View File

@ -882,7 +882,6 @@ Pool.prototype._handleBlock = function _handleBlock(block, peer, callback) {
if (err.reason === 'bad-prevblk') {
if (self.options.headers) {
peer.setMisbehavior(10);
peer.destroy();
return callback(err);
}
return self.resolveOrphan(peer, null, block.hash('hex'), function(e) {