diff --git a/packages/devp2p/src/protocol/eth.ts b/packages/devp2p/src/protocol/eth.ts index c58bcec679..68be0c35b6 100644 --- a/packages/devp2p/src/protocol/eth.ts +++ b/packages/devp2p/src/protocol/eth.ts @@ -59,15 +59,15 @@ export class ETH extends Protocol { _handleMessage(code: ETH.MESSAGE_CODES, data: Uint8Array) { const payload = RLP.decode(data) - const debugMsg = this.DEBUG - ? // @ts-ignore - `Received ${this.getMsgPrefix(code)} message from ${this._peer._socket.remoteAddress}:${ - // @ts-ignore - this._peer._socket.remotePort - }` - : undefined if (code !== ETH.MESSAGE_CODES.STATUS && this.DEBUG) { + const debugMsg = this.DEBUG + ? // @ts-ignore + `Received ${this.getMsgPrefix(code)} message from ${this._peer._socket.remoteAddress}:${ + // @ts-ignore + this._peer._socket.remotePort + }` + : undefined const logData = formatLogData(bytesToHex(data), this._verbose) this.debug(this.getMsgPrefix(code), `${debugMsg}: ${logData}`) } @@ -85,6 +85,15 @@ export class ETH extends Protocol { this._peerStatus !== undefined ? this._getStatusString(this._peerStatus) : '' }` if (this.DEBUG) { + const debugMsg = this.DEBUG + ? `Received ${this.getMsgPrefix(code)} message from ${ + // @ts-ignore + this._peer._socket.remoteAddress + }:${ + // @ts-ignore + this._peer._socket.remotePort + }` + : undefined this.debug(this.getMsgPrefix(code), `${debugMsg}: ${peerStatusMsg}`) } this._handleStatus()