From 018241fc7881dfbb27f989711c0836c6047675e4 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 26 Jul 2016 01:14:35 -0700 Subject: [PATCH] bip151: set processed to zero on rekey. --- lib/bcoin/bip151.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bcoin/bip151.js b/lib/bcoin/bip151.js index 2482dc99..4054c7b5 100644 --- a/lib/bcoin/bip151.js +++ b/lib/bcoin/bip151.js @@ -83,10 +83,10 @@ BIP151Stream.prototype.maybeRekey = function maybeRekey(data) { this.processed += data.length; - if (now > this.lastRekey + 10 + if (now >= this.lastRekey + 10 || this.processed >= this.highWaterMark) { this.lastRekey = utils.now(); - this.processed -= this.highWaterMark; + this.processed = 0; this.emit('rekey'); this.rekey(); }