changed getUserPublicKey function to readDB to get userPublicData in deposit_asset_request in backup_receive_rpc_response

This commit is contained in:
Abhishek Sinha 2019-06-18 16:04:15 +05:30
parent 2cf168039a
commit 0c7abd21bb

View File

@ -10348,8 +10348,8 @@
} }
Promise.all(promises).then(cs=>{ Promise.all(promises).then(cs=>{
let isPreviousSupernodesLive = cs.map((su_status, index)=> let isPreviousSupernodesLive = cs.map((su_status)=>
(typeof su_status[index] !== "object" || su_status[index].is_live == true ) (typeof su_status[0] !== "object" || su_status[0].is_live == true )
); );
if (!isPreviousSupernodesLive.includes(true)) { if (!isPreviousSupernodesLive.includes(true)) {
@ -12833,7 +12833,7 @@
// already processed above // already processed above
break; break;
case "deposit_asset_request": case "deposit_asset_request":
RM_RPC.filter_legit_backup_requests(params.trader_flo_address, function (is_valid_request) { RM_RPC.filter_legit_backup_requests(params.trader_flo_address, async function (is_valid_request) {
if (is_valid_request !== true) return false; if (is_valid_request !== true) return false;
@ -12853,9 +12853,12 @@
typeof params.trader_flo_address == "string" && typeof params.trader_flo_address == "string" &&
params.trader_flo_address.length > 0 params.trader_flo_address.length > 0
) { ) {
RM_WALLET.getUserPublicKey(params.trader_flo_address, const requester_public_req = await backup_server_db_instance
async function (requester_public_key) { .backup_readDB('userPublicData', params.trader_flo_address);
if (requester_public_key == undefined || if (typeof requester_public_req!=="object") return;
const requester_public_key = requester_public_req.trader_flo_pubKey;
if (typeof requester_public_key == "undefined" ||
requester_public_key == null) { requester_public_key == null) {
err_msg = 'Failed to get public key of the user.'; err_msg = 'Failed to get public key of the user.';
showMessage(err_msg); showMessage(err_msg);
@ -13201,7 +13204,6 @@
} }
}); });
} }
});
} else { } else {
err_msg = "deposit asset request error"; err_msg = "deposit asset request error";
@ -15576,7 +15578,7 @@
if (typeof res_obj.globalParams !== "object" if (typeof res_obj.globalParams !== "object"
|| (typeof res_obj.globalParams.receiversList == "object" || (typeof res_obj.globalParams.receiversList == "object"
&& !request.globalParams.receiversList && !res_obj.globalParams.receiversList
.includes(localbitcoinplusplus.wallets.my_local_flo_address) .includes(localbitcoinplusplus.wallets.my_local_flo_address)
)) return; )) return;
@ -16634,7 +16636,8 @@
//"receiver_flo_address": "", // message for all //"receiver_flo_address": "", // message for all
//"ws_url": websocket.url, //"ws_url": websocket.url,
"server_msg": `Your primary/secondary Supernode is live and synced. You can start using the system.`, "server_msg": `Your primary/secondary Supernode is live and synced. You can start using the system.`,
}).then(server_response=>doSend(server_response)); })
//.then(server_response=>doSend(server_response));
}); });
} }
@ -16827,7 +16830,7 @@
if (typeof res_obj.globalParams !== "object" if (typeof res_obj.globalParams !== "object"
|| (typeof res_obj.globalParams.receiversList == "object" || (typeof res_obj.globalParams.receiversList == "object"
&& !request.globalParams.receiversList && !res_obj.globalParams.receiversList
.includes(localbitcoinplusplus.wallets.my_local_flo_address) .includes(localbitcoinplusplus.wallets.my_local_flo_address)
)) return; )) return;
@ -20256,7 +20259,7 @@
wsUri = await localbitcoinplusplus.kademlia.getSupernodeSeed(idbData.myLocalFLOAddress); wsUri = await localbitcoinplusplus.kademlia.getSupernodeSeed(idbData.myLocalFLOAddress);
if (localbitcoinplusplus.master_configurations.supernodesPubKeys.includes(idbData.myLocalFLOPublicKey)) { if (localbitcoinplusplus.master_configurations.supernodesPubKeys.includes(idbData.myLocalFLOPublicKey)) {
return;
showMessage(`INFO: Syncing of latest data starting. This could take some time. Do not close the window until then.`); showMessage(`INFO: Syncing of latest data starting. This could take some time. Do not close the window until then.`);
// Get data for deposits and withdraw starting from first (and currently alive) backup supernode // Get data for deposits and withdraw starting from first (and currently alive) backup supernode
@ -20954,8 +20957,7 @@
if (typeof reserve_res == "object") { if (typeof reserve_res == "object") {
reserve_res.map(reserves => { reserve_res.map(reserves => {
reserves.balance = balance; reserves.balance = balance;
_updateinDB('system_btc_reserves_private_keys', reserves, _updateinDB('system_btc_reserves_private_keys', reserves, reserves.id);
reserves.id);
}); });
} }
}); });