debug messages for dos prevention.
This commit is contained in:
parent
47af5987ae
commit
009f4f9f72
@ -558,6 +558,7 @@ Pool.prototype._handleBlock = function _handleBlock(block, peer) {
|
|||||||
// Ensure the block was not invalid last time.
|
// Ensure the block was not invalid last time.
|
||||||
// Someone might be sending us bad blocks to DoS us.
|
// Someone might be sending us bad blocks to DoS us.
|
||||||
if (this.block.invalid[block.hash('hex')]) {
|
if (this.block.invalid[block.hash('hex')]) {
|
||||||
|
this.emit('debug', 'Peer is sending an invalid chain (%s)', peer.host);
|
||||||
this.misbehaving(peer, 100);
|
this.misbehaving(peer, 100);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -565,6 +566,7 @@ Pool.prototype._handleBlock = function _handleBlock(block, peer) {
|
|||||||
// Ensure this is not a continuation
|
// Ensure this is not a continuation
|
||||||
// of an invalid chain.
|
// of an invalid chain.
|
||||||
if (this.block.invalid[block.prevBlock]) {
|
if (this.block.invalid[block.prevBlock]) {
|
||||||
|
this.emit('debug', 'Peer is sending an invalid chain (%s)', peer.host);
|
||||||
this.misbehaving(peer, 100);
|
this.misbehaving(peer, 100);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -604,6 +606,7 @@ Pool.prototype._handleBlock = function _handleBlock(block, peer) {
|
|||||||
// Make sure the peer doesn't send us
|
// Make sure the peer doesn't send us
|
||||||
// more than 100 orphans every 3 minutes.
|
// more than 100 orphans every 3 minutes.
|
||||||
if (this.orphaning(peer)) {
|
if (this.orphaning(peer)) {
|
||||||
|
this.emit('debug', 'Peer is orphaning (%s)', peer.host);
|
||||||
this.misbehaving(peer, 100);
|
this.misbehaving(peer, 100);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user