From db9b9547d99068781eaccd5c0c3d4717d3bb4339 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 12 Jun 2017 14:33:50 +0200 Subject: [PATCH] don't complain about missing callbacks for messages which are not our responsibility --- www/common/rpc.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/www/common/rpc.js b/www/common/rpc.js index 7bd22957b..530a65483 100644 --- a/www/common/rpc.js +++ b/www/common/rpc.js @@ -50,7 +50,11 @@ types of messages: return void console.error(new Error('could not parse message: %s', msg)); } + // RPC messages are always arrays. + if (!Array.isArray(parsed)) { return; } var txid = parsed[0]; + // txid must be a string, or this message is not meant for us + if (typeof(txid) !== 'string') { return; } var cookie = parsed[1]; var pending = ctx.pending[txid]; @@ -92,10 +96,9 @@ types of messages: // if successful, delete the callback... delete ctx.pending[txid]; + return; } - else { - console.error("received message for txid with no callback"); - } + console.error("received message for txid[%s] with no callback", txid); }; var create = function (network, edPrivateKey, edPublicKey, cb) {