From 009f4f9f721672a040f30837e5a38594973d3fc4 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 20 Jan 2016 02:48:42 -0800 Subject: [PATCH] debug messages for dos prevention. --- lib/bcoin/pool.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/bcoin/pool.js b/lib/bcoin/pool.js index 28b7b465..7c745e77 100644 --- a/lib/bcoin/pool.js +++ b/lib/bcoin/pool.js @@ -558,6 +558,7 @@ Pool.prototype._handleBlock = function _handleBlock(block, peer) { // Ensure the block was not invalid last time. // Someone might be sending us bad blocks to DoS us. if (this.block.invalid[block.hash('hex')]) { + this.emit('debug', 'Peer is sending an invalid chain (%s)', peer.host); this.misbehaving(peer, 100); return false; } @@ -565,6 +566,7 @@ Pool.prototype._handleBlock = function _handleBlock(block, peer) { // Ensure this is not a continuation // of an invalid chain. if (this.block.invalid[block.prevBlock]) { + this.emit('debug', 'Peer is sending an invalid chain (%s)', peer.host); this.misbehaving(peer, 100); return false; } @@ -604,6 +606,7 @@ Pool.prototype._handleBlock = function _handleBlock(block, peer) { // Make sure the peer doesn't send us // more than 100 orphans every 3 minutes. if (this.orphaning(peer)) { + this.emit('debug', 'Peer is orphaning (%s)', peer.host); this.misbehaving(peer, 100); return false; }