diff --git a/supernode/index.html b/supernode/index.html
index 46fbd72..99b4f19 100644
--- a/supernode/index.html
+++ b/supernode/index.html
@@ -10903,7 +10903,7 @@
}
-
+
@@ -11598,6 +11615,7 @@
loadExternalFiles();
dataBaseUIOperations();
}
+
Promise.resolve(true);
} else {
let mes = `WARNING: Failed to build your private key. You can reset keys and generate new keys from keys section below.`;
@@ -15990,7 +16008,7 @@
) {
RM_WALLET.manually_assign_my_private_key();
loadExternalFiles();
- dataBaseUIOperations();
+ dataBaseUIOperations();
} else if(typeof localbitcoinplusplus.wallets.MY_SUPERNODE_PRIVATE_KEY=='string' &&
localbitcoinplusplus.is_ui_loaded == false) {
loadExternalFiles();
@@ -16006,6 +16024,9 @@
if (localbitcoinplusplus.master_configurations.supernodesPubKeys
.includes(idbData.myLocalFLOPublicKey)) {
+ // Invoke functions
+ reactor.dispatchEvent('user_flo_keys_active', idbData);
+
wsUri.map((uri, index)=>{
// Do not serve to any requests unless data is fully synced.
@@ -16018,9 +16039,6 @@
}
});
- // Connect to nearest live backup nodes
- reactor.dispatchEvent('resolve_backup_ws_connections');
-
}
resolve(true);
@@ -16077,6 +16095,7 @@
}
});
reactor.dispatchEvent('backup_supernode_up');
+ reactor.dispatchEvent('clean_dead_ws_conections');
}.bind(this);
this.ws_connection.onclose = function (evt) {
reactor.addEventListener('backup_supernode_down', function() {
@@ -16084,6 +16103,7 @@
switchMyWS.updateSupernodeAvailabilityStatus(evt.srcElement.url, false);
});
reactor.dispatchEvent('backup_supernode_down');
+ reactor.dispatchEvent('clean_dead_ws_conections');
}.bind(this);
this.ws_connection.onmessage = function (evt) {
let response = evt.data;
@@ -16269,6 +16289,43 @@
}
},
+
+ async switchToBackupWSForSuperNodesOperations(disconnected_url='') {
+
+ const user_data = await readDB('localbitcoinUser', '00-01');
+ const user_flo_address = user_data.myLocalFLOAddress;
+ disconnected_url = disconnected_url.replace(/\/$/, '');
+
+ if(typeof user_flo_address !== "string"
+ || !localbitcoinplusplus.master_configurations.supernodesPubKeys
+ .includes(user_flo_address)) return false;
+
+ let ideal_supernode = '';
+
+ const myClosestSupernodesArray = await readAllDB(`myClosestSupernodes`);
+
+ let nextClosestSupernodeElem = myClosestSupernodesArray
+ .filter((wew, index)=>{
+ let ww = `ws://${wew.ip}:${wew.port}`;
+ if(typeof z =='boolean' && z) {
+ z = false;
+ localbitcoinplusplus.MY_SUPERNODE_FLO_ADDRESS = wew.trader_flo_address;
+ return ww;
+ }
+ if(ww==disconnected_url) z = true;
+ });
+
+ await reactor.dispatchEvent('shift_ws_connection', nextClosestSupernodeElem[0]);
+
+ if(websocket.readyState===1) {
+ return Promise.resolve(websocket.readyState);
+ } else {
+ let ms = `Error: Failed to connect to any supernode.`;
+ showMessage(ms)
+ return Promise.reject(ms);
+ }
+
+ },
}
function startWebSocket(wsUri) {