bip151: minor refactor.
This commit is contained in:
parent
c597d7c411
commit
b7c280a84c
@ -85,7 +85,7 @@ BIP151Stream.prototype.maybeRekey = function maybeRekey(data) {
|
|||||||
|
|
||||||
if (now >= this.lastRekey + 10
|
if (now >= this.lastRekey + 10
|
||||||
|| this.processed >= this.highWaterMark) {
|
|| this.processed >= this.highWaterMark) {
|
||||||
this.lastRekey = utils.now();
|
this.lastRekey = now;
|
||||||
this.processed = 0;
|
this.processed = 0;
|
||||||
this.emit('rekey');
|
this.emit('rekey');
|
||||||
this.rekey();
|
this.rekey();
|
||||||
@ -349,13 +349,11 @@ BIP151.prototype.encinit = function encinit(data) {
|
|||||||
var cipher = p.readU8();
|
var cipher = p.readU8();
|
||||||
|
|
||||||
assert(!this.initReceived, 'Already initialized.');
|
assert(!this.initReceived, 'Already initialized.');
|
||||||
|
this.initReceived = true;
|
||||||
|
|
||||||
assert(cipher === this.output.cipher, 'Cipher mismatch.');
|
assert(cipher === this.output.cipher, 'Cipher mismatch.');
|
||||||
|
|
||||||
this.output.init(publicKey);
|
this.output.init(publicKey);
|
||||||
|
|
||||||
this.initReceived = true;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BIP151.prototype.toEncack = function toEncack(writer) {
|
BIP151.prototype.toEncack = function toEncack(writer) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user