fixed node live status and removed break from doSend dunction
This commit is contained in:
parent
7cc2577610
commit
772b516c50
@ -15362,7 +15362,28 @@
|
|||||||
if (res_obj.method==="is_node_alive_request"
|
if (res_obj.method==="is_node_alive_request"
|
||||||
&& localbitcoinplusplus.master_configurations.supernodesPubKeys
|
&& localbitcoinplusplus.master_configurations.supernodesPubKeys
|
||||||
.includes(localbitcoinplusplus.wallets.my_local_flo_public_key)
|
.includes(localbitcoinplusplus.wallets.my_local_flo_public_key)
|
||||||
&& (res_obj.params[0].receiver_flo_address == localbitcoinplusplus.wallets.my_local_flo_address)) {
|
&& (res_obj.params[0].receiver_flo_address ==
|
||||||
|
localbitcoinplusplus.wallets.my_local_flo_address)) {
|
||||||
|
// Register his attendance
|
||||||
|
reactor.dispatchEvent('nodeIsAlive', res_obj);
|
||||||
|
// Send your live status to Sender
|
||||||
|
const RM_RPC = new localbitcoinplusplus.rpc;
|
||||||
|
RM_RPC
|
||||||
|
.send_rpc
|
||||||
|
.call(this, "yup_i_am_awake", {
|
||||||
|
JOB: 'I_AM_ALIVE',
|
||||||
|
trader_flo_address: localbitcoinplusplus.wallets.my_local_flo_address,
|
||||||
|
receiver_flo_address: res_obj.globalParams.senderFloId
|
||||||
|
}).then(req=>doSend(req));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res_obj.method=="yup_i_am_awake"
|
||||||
|
&& localbitcoinplusplus.master_configurations.supernodesPubKeys
|
||||||
|
.includes(localbitcoinplusplus.wallets.my_local_flo_public_key)
|
||||||
|
&& (res_obj.params[0].receiver_flo_address ==
|
||||||
|
localbitcoinplusplus.wallets.my_local_flo_address)) {
|
||||||
|
|
||||||
reactor.dispatchEvent('nodeIsAlive', res_obj);
|
reactor.dispatchEvent('nodeIsAlive', res_obj);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -15498,6 +15519,12 @@
|
|||||||
function onOpen(evt) {
|
function onOpen(evt) {
|
||||||
localbitcoinplusplus.amIreadyToServePrimaryUsers = false;
|
localbitcoinplusplus.amIreadyToServePrimaryUsers = false;
|
||||||
reactor.dispatchEvent('new_supernode_connected', evt);
|
reactor.dispatchEvent('new_supernode_connected', evt);
|
||||||
|
readAllDB('myClosestSupernodes').then(sconn=>{
|
||||||
|
const switchMyWS = new backupSupernodesWebSocketObject();
|
||||||
|
sconn.map((m,i)=>{
|
||||||
|
if(i>0) switchMyWS.updateSupernodeAvailabilityStatus(m.trader_flo_address, false);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onClose(evt) {
|
function onClose(evt) {
|
||||||
@ -16632,7 +16659,7 @@
|
|||||||
if (obj.length > 0) {
|
if (obj.length > 0) {
|
||||||
for (var prop in obj) {
|
for (var prop in obj) {
|
||||||
if (!obj.hasOwnProperty(prop)) continue;
|
if (!obj.hasOwnProperty(prop)) continue;
|
||||||
await localbitcoinplusplus.newBackupDatabase.db[trader_flo_address]
|
await localbitcoinplusplus.newBackupDatabase.db[su_db_data.trader_flo_address]
|
||||||
.backup_updateinDB(tableStoreName, obj[prop], obj[prop]
|
.backup_updateinDB(tableStoreName, obj[prop], obj[prop]
|
||||||
.trader_flo_address).then(()=>{
|
.trader_flo_address).then(()=>{
|
||||||
showMessage(`INFO: "${tableStoreName}" datastore syncing is complete.`);
|
showMessage(`INFO: "${tableStoreName}" datastore syncing is complete.`);
|
||||||
@ -16640,13 +16667,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let resdbdata = await localbitcoinplusplus.newBackupDatabase.db[trader_flo_address]
|
let resdbdata = await localbitcoinplusplus.newBackupDatabase.db[su_db_data.trader_flo_address]
|
||||||
.backup_removeAllinDB(tableStoreName);
|
.backup_removeAllinDB(tableStoreName);
|
||||||
if (resdbdata !== false) {
|
if (resdbdata !== false) {
|
||||||
if (obj.length > 0) {
|
if (obj.length > 0) {
|
||||||
for (var prop in obj) {
|
for (var prop in obj) {
|
||||||
if (!obj.hasOwnProperty(prop)) continue;
|
if (!obj.hasOwnProperty(prop)) continue;
|
||||||
await localbitcoinplusplus.newBackupDatabase.db[trader_flo_address]
|
await localbitcoinplusplus.newBackupDatabase.db[su_db_data.trader_flo_address]
|
||||||
.backup_addDB(resdbdata, obj[prop]).then(()=>{
|
.backup_addDB(resdbdata, obj[prop]).then(()=>{
|
||||||
showMessage(`INFO: "${resdbdata}" datastore syncing is complete.`);
|
showMessage(`INFO: "${resdbdata}" datastore syncing is complete.`);
|
||||||
});
|
});
|
||||||
@ -16684,6 +16711,27 @@
|
|||||||
if(localbitcoinplusplus.master_configurations.supernodesPubKeys
|
if(localbitcoinplusplus.master_configurations.supernodesPubKeys
|
||||||
.includes(localbitcoinplusplus.wallets.my_local_flo_public_key)) {
|
.includes(localbitcoinplusplus.wallets.my_local_flo_public_key)) {
|
||||||
reactor.dispatchEvent('nodeIsAlive', res_obj);
|
reactor.dispatchEvent('nodeIsAlive', res_obj);
|
||||||
|
// Send your live status to Sender
|
||||||
|
const RM_RPC = new localbitcoinplusplus.rpc;
|
||||||
|
RM_RPC
|
||||||
|
.send_rpc
|
||||||
|
.call(this, "yup_i_am_awake", {
|
||||||
|
JOB: 'I_AM_ALIVE',
|
||||||
|
trader_flo_address: localbitcoinplusplus.wallets.my_local_flo_address,
|
||||||
|
receiver_flo_address: res_obj.globalParams.senderFloId
|
||||||
|
}).then(req=>doSend(req));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "yup_i_am_awake":
|
||||||
|
if (res_obj.method=="yup_i_am_awake"
|
||||||
|
&& localbitcoinplusplus.master_configurations.supernodesPubKeys
|
||||||
|
.includes(localbitcoinplusplus.wallets.my_local_flo_public_key)
|
||||||
|
&& (res_obj.params[0].receiver_flo_address ==
|
||||||
|
localbitcoinplusplus.wallets.my_local_flo_address)) {
|
||||||
|
|
||||||
|
reactor.dispatchEvent('nodeIsAlive', res_obj);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -18011,9 +18059,30 @@
|
|||||||
if(localbitcoinplusplus.master_configurations.supernodesPubKeys
|
if(localbitcoinplusplus.master_configurations.supernodesPubKeys
|
||||||
.includes(localbitcoinplusplus.wallets.my_local_flo_public_key)) {
|
.includes(localbitcoinplusplus.wallets.my_local_flo_public_key)) {
|
||||||
reactor.dispatchEvent('nodeIsAlive', res_obj);
|
reactor.dispatchEvent('nodeIsAlive', res_obj);
|
||||||
|
// Send your live status to Sender
|
||||||
|
const RM_RPC = new localbitcoinplusplus.rpc;
|
||||||
|
RM_RPC
|
||||||
|
.send_rpc
|
||||||
|
.call(this, "yup_i_am_awake", {
|
||||||
|
JOB: 'I_AM_ALIVE',
|
||||||
|
trader_flo_address: localbitcoinplusplus.wallets.my_local_flo_address,
|
||||||
|
receiver_flo_address: res_obj.globalParams.senderFloId
|
||||||
|
}).then(req=>doSend(req));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "yup_i_am_awake":
|
||||||
|
if (res_obj.method=="yup_i_am_awake"
|
||||||
|
&& localbitcoinplusplus.master_configurations.supernodesPubKeys
|
||||||
|
.includes(localbitcoinplusplus.wallets.my_local_flo_public_key)
|
||||||
|
&& (res_obj.params[0].receiver_flo_address ==
|
||||||
|
localbitcoinplusplus.wallets.my_local_flo_address)) {
|
||||||
|
|
||||||
|
reactor.dispatchEvent('nodeIsAlive', res_obj);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -18893,9 +18962,9 @@
|
|||||||
let msg = "WARNING: Websocket not ready to broadcast messages.";
|
let msg = "WARNING: Websocket not ready to broadcast messages.";
|
||||||
showMessage(msg);
|
showMessage(msg);
|
||||||
console.warn(msg);
|
console.warn(msg);
|
||||||
break;
|
} else {
|
||||||
|
ws_conn.send(finalMessage);
|
||||||
}
|
}
|
||||||
ws_conn.send(finalMessage);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -20892,7 +20961,8 @@
|
|||||||
|
|
||||||
reactor.addEventListener('nodeIsAlive', function(res_obj) {
|
reactor.addEventListener('nodeIsAlive', function(res_obj) {
|
||||||
try {
|
try {
|
||||||
if (res_obj.params[0].JOB !== "ARE_YOU_ALIVE") return;
|
if (res_obj.params[0].JOB !== "ARE_YOU_ALIVE"
|
||||||
|
|| res_obj.params[0].JOB !== "I_AM_ALIVE") return;
|
||||||
const params=res_obj.params[0];
|
const params=res_obj.params[0];
|
||||||
if (params.receiver_flo_address !== localbitcoinplusplus.wallets.my_local_flo_address) return;
|
if (params.receiver_flo_address !== localbitcoinplusplus.wallets.my_local_flo_address) return;
|
||||||
const switchMyWS = new backupSupernodesWebSocketObject();
|
const switchMyWS = new backupSupernodesWebSocketObject();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user