From a05ae79e941cd6ec0d09d6aee8da3fcde1a770a5 Mon Sep 17 00:00:00 2001 From: sairajzero Date: Thu, 22 Dec 2022 02:37:10 +0530 Subject: [PATCH] Node URL change - update the node URL by sending message in blockchain (from exchangeID) JSON property Nodes.update: {nodeID: nodeURL} --- docs/scripts/floExchangeAPI.js | 3 +++ src/main.js | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/scripts/floExchangeAPI.js b/docs/scripts/floExchangeAPI.js index 045ed0f..a298d98 100644 --- a/docs/scripts/floExchangeAPI.js +++ b/docs/scripts/floExchangeAPI.js @@ -1752,6 +1752,9 @@ if (content.Nodes.add) for (let n in content.Nodes.add) nodes[n] = content.Nodes.add[n]; + if (content.Nodes.update) + for (let n in content.Nodes.update) + nodes[n] = content.Nodes.update[n]; } //Trusted List if (content.Trusted) { diff --git a/src/main.js b/src/main.js index 2a9b4f1..0f20eee 100644 --- a/src/main.js +++ b/src/main.js @@ -60,6 +60,9 @@ function refreshDataFromBlockchain() { if (content.Nodes.add) for (let n in content.Nodes.add) promises.push(DB.query("INSERT INTO NodeList (floID, uri) VALUE (?) ON DUPLICATE KEY UPDATE uri=?", [[n, content.Nodes.add[n]], content.Nodes.add[n]])); + if (content.Nodes.update) + for (let n in content.Nodes.update) + promises.push(DB.query("UPDATE NodeList SET uri=? WHERE floID=?", [content.Nodes.update[n], n])); } //Asset List if (content.Assets) { @@ -173,7 +176,7 @@ module.exports = function startServer() { } const config = require(`../args/config${_I}.json`); try { - var _tmp = require(`../args/keys${_I}.json`); + let _tmp = require(`../args/keys${_I}.json`); _tmp = floCrypto.retrieveShamirSecret(_tmp); if (!_pass) { console.error('Password not entered!');