net: bip150 - do not attempt handshake if bip151 handshake failed.
This commit is contained in:
parent
7b61e32a70
commit
aa7f105f38
@ -44,7 +44,7 @@ bip151: true
|
||||
listen: true
|
||||
max-peers: 8
|
||||
max-leeches: 30
|
||||
bip150: true
|
||||
bip150: false
|
||||
identity-key: 74b4147957813b62cc8987f2b711ddb31f8cb46dcbf71502033da66053c8780a
|
||||
auth-peers: ./authorized-peers
|
||||
known-peers: ./known-peers
|
||||
|
||||
@ -292,7 +292,7 @@ Peer.prototype._onConnect = function _onConnect() {
|
||||
assert(!this.bip151.completed);
|
||||
this.logger.info('Attempting BIP151 handshake (%s).', this.hostname);
|
||||
this.write(this.framer.encinit(this.bip151.toEncinit()));
|
||||
return this.bip151.wait(5000, function(err) {
|
||||
return this.bip151.wait(3000, function(err) {
|
||||
if (err)
|
||||
self._error(err, true);
|
||||
self._onBIP151();
|
||||
@ -320,10 +320,19 @@ Peer.prototype._onBIP151 = function _onBIP151() {
|
||||
|
||||
if (this.bip150) {
|
||||
assert(!this.bip150.completed);
|
||||
|
||||
if (!this.bip151.handshake)
|
||||
return this._error('BIP151 handshake was not completed for BIP150.');
|
||||
|
||||
this.logger.info('Attempting BIP150 handshake (%s).', this.hostname);
|
||||
if (this.bip150.outbound && this.bip150.peerIdentity)
|
||||
|
||||
if (this.bip150.outbound) {
|
||||
if (!this.bip150.peerIdentity)
|
||||
return this._error('No known identity for peer.');
|
||||
this.write(this.framer.authChallenge(this.bip150.toChallenge()));
|
||||
return this.bip150.wait(5000, function(err) {
|
||||
}
|
||||
|
||||
return this.bip150.wait(3000, function(err) {
|
||||
if (err)
|
||||
return self._error(err);
|
||||
self._onHandshake();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user