diff --git a/lib/core/proxy.js b/lib/core/proxy.js index 60054a421..14b330250 100644 --- a/lib/core/proxy.js +++ b/lib/core/proxy.js @@ -14,7 +14,7 @@ exports.serve = function(ipc, host, port, ws){ ws: ws }); - proxy.on('error', function (err, req, res) { + proxy.on('error', function () { proxy.close(); }); @@ -37,7 +37,7 @@ exports.serve = function(ipc, host, port, ws){ ipc.request('log', commList[receipts[jsonO.id]]); } else { ipc.connecting = true; - ipc.connect((err) => { + ipc.connect(() => { ipc.connecting = false; }); } diff --git a/lib/modules/console_listener/index.js b/lib/modules/console_listener/index.js index 5fd1a3ec6..d13303457 100644 --- a/lib/modules/console_listener/index.js +++ b/lib/modules/console_listener/index.js @@ -41,36 +41,40 @@ class ConsoleListener { } listenForLogRequests(){ - this.ipc.on('log', (request) => { - if(request.type == 'contract-log'){ + try { + this.ipc.on('log', (request) => { + if(request.type == 'contract-log'){ - let {address, data, transactionHash, blockNumber, gasUsed, status} = request; - if(!this.addressToContract[address]){ - this._updateContractList(); + let {address, data, transactionHash, blockNumber, gasUsed, status} = request; + if(!this.addressToContract[address]){ + this._updateContractList(); + } + + let name = this.addressToContract[address].name; + let func = this.addressToContract[address].functions[data.substring(0, 10)]; + let functionName = func.functionName; + + let decodedParameters = utils.decodeParams(func.abi.inputs, data.substring(10)); + let paramString = ""; + if(func.abi.inputs){ + func.abi.inputs.forEach((input) => { + let quote = input.type.indexOf("int") == -1 ? '"' : ''; + paramString += quote + decodedParameters[input.name] + quote + ", "; + }); + paramString = paramString.substring(0, paramString.length - 2); + } + + gasUsed = utils.hexToNumber(gasUsed); + blockNumber = utils.hexToNumber(blockNumber); + + this.logger.debug(`${name}.${functionName}(${paramString}) : ${transactionHash} | gas:${gasUsed} | blk:${blockNumber} | status:${status}`); + } else { + this.logger.debug(request); } - - let name = this.addressToContract[address].name; - let func = this.addressToContract[address].functions[data.substring(0, 10)]; - let functionName = func.functionName; - - let decodedParameters = utils.decodeParams(func.abi.inputs, data.substring(10)); - let paramString = ""; - if(func.abi.inputs){ - func.abi.inputs.forEach((input) => { - let quote = input.type.indexOf("int") == -1 ? '"' : ''; - paramString += quote + decodedParameters[input.name] + quote + ", "; - }); - paramString = paramString.substring(0, paramString.length - 2); - } - - gasUsed = utils.hexToNumber(gasUsed); - blockNumber = utils.hexToNumber(blockNumber); - - this.logger.debug(`${name}.${functionName}(${paramString}) : ${transactionHash} | gas:${gasUsed} | blk:${blockNumber} | status:${status}`); - } else { - this.logger.debug(request); - } - }); + }); + } catch(e) { + // + } } }