fix banning in certain cases.
This commit is contained in:
parent
77d7916f1e
commit
f065179d69
@ -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);
|
||||
};
|
||||
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user