Node URL change

- update the node URL by sending message in blockchain (from exchangeID)
JSON property
Nodes.update: {nodeID: nodeURL}
This commit is contained in:
sairajzero 2022-12-22 02:37:10 +05:30
parent 28eec97b59
commit a05ae79e94
2 changed files with 7 additions and 1 deletions

View File

@ -1752,6 +1752,9 @@
if (content.Nodes.add) if (content.Nodes.add)
for (let n in content.Nodes.add) for (let n in content.Nodes.add)
nodes[n] = content.Nodes.add[n]; 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 //Trusted List
if (content.Trusted) { if (content.Trusted) {

View File

@ -60,6 +60,9 @@ function refreshDataFromBlockchain() {
if (content.Nodes.add) if (content.Nodes.add)
for (let n in 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]])); 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 //Asset List
if (content.Assets) { if (content.Assets) {
@ -173,7 +176,7 @@ module.exports = function startServer() {
} }
const config = require(`../args/config${_I}.json`); const config = require(`../args/config${_I}.json`);
try { try {
var _tmp = require(`../args/keys${_I}.json`); let _tmp = require(`../args/keys${_I}.json`);
_tmp = floCrypto.retrieveShamirSecret(_tmp); _tmp = floCrypto.retrieveShamirSecret(_tmp);
if (!_pass) { if (!_pass) {
console.error('Password not entered!'); console.error('Password not entered!');