fixed updateinDB logical error in handling_backup_messages cases
This commit is contained in:
parent
c3b11c60bd
commit
d68882ac05
@ -15087,7 +15087,7 @@
|
|||||||
) {
|
) {
|
||||||
if (typeof flo_id !== null || typeof flo_id !== "undefined") {
|
if (typeof flo_id !== null || typeof flo_id !== "undefined") {
|
||||||
localbitcoinplusplus.kademlia
|
localbitcoinplusplus.kademlia
|
||||||
.determineClosestSupernode('', '', '', flo_id)
|
.determineClosestSupernode(flo_id)
|
||||||
.then(my_closest_su => {
|
.then(my_closest_su => {
|
||||||
if (user_keys.address === my_closest_su[0].data.id) {
|
if (user_keys.address === my_closest_su[0].data.id) {
|
||||||
return callback(true);
|
return callback(true);
|
||||||
@ -21947,9 +21947,14 @@
|
|||||||
withdraw_success_response.hash &&
|
withdraw_success_response.hash &&
|
||||||
update_cash_balance_obj_res_verification == true
|
update_cash_balance_obj_res_verification == true
|
||||||
) {
|
) {
|
||||||
|
// Since this is a response from Supernode update and increase
|
||||||
|
// data by vectorClock is false
|
||||||
updateinDB(
|
updateinDB(
|
||||||
"cash_balances",
|
"cash_balances",
|
||||||
withdraw_success_response.withdrawer_cash_data
|
withdraw_success_response.withdrawer_cash_data,
|
||||||
|
withdraw_success_response.withdrawer_cash_data.id,
|
||||||
|
false,
|
||||||
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
// Update balances
|
// Update balances
|
||||||
@ -22168,7 +22173,10 @@
|
|||||||
if (isBalanceLegit) {
|
if (isBalanceLegit) {
|
||||||
updateinDB(
|
updateinDB(
|
||||||
"crypto_balances",
|
"crypto_balances",
|
||||||
updateUserCryptoBalanceResponseObject.updatedBTCBalanceObject
|
updateUserCryptoBalanceResponseObject.updatedBTCBalanceObject,
|
||||||
|
updateUserCryptoBalanceResponseObject.updatedBTCBalanceObject.id,
|
||||||
|
false,
|
||||||
|
false
|
||||||
);
|
);
|
||||||
if (
|
if (
|
||||||
localbitcoinplusplus.wallets.my_local_flo_address ==
|
localbitcoinplusplus.wallets.my_local_flo_address ==
|
||||||
@ -22177,7 +22185,7 @@
|
|||||||
displayBalances(
|
displayBalances(
|
||||||
updateUserCryptoBalanceResponseObject.trader_flo_address
|
updateUserCryptoBalanceResponseObject.trader_flo_address
|
||||||
);
|
);
|
||||||
showMessage(`INFO: Your balance is updated.`);
|
showMessage(`INFO: Your Crypto balance is updated.`);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -22209,7 +22217,10 @@
|
|||||||
if (isBalanceLegit) {
|
if (isBalanceLegit) {
|
||||||
updateinDB(
|
updateinDB(
|
||||||
"deposit",
|
"deposit",
|
||||||
updateUserDepositsResponseObject.updatedTraderDepositObject
|
updateUserDepositsResponseObject.updatedTraderDepositObject,
|
||||||
|
updateUserDepositsResponseObject.updatedTraderDepositObject.id,
|
||||||
|
false,
|
||||||
|
false
|
||||||
);
|
);
|
||||||
if (
|
if (
|
||||||
localbitcoinplusplus.wallets.my_local_flo_address ==
|
localbitcoinplusplus.wallets.my_local_flo_address ==
|
||||||
@ -23951,7 +23962,10 @@
|
|||||||
) {
|
) {
|
||||||
updateinDB(
|
updateinDB(
|
||||||
"cash_balances",
|
"cash_balances",
|
||||||
withdraw_success_response.withdrawer_cash_data
|
withdraw_success_response.withdrawer_cash_data,
|
||||||
|
withdraw_success_response.withdrawer_cash_data.id,
|
||||||
|
false,
|
||||||
|
false
|
||||||
);
|
);
|
||||||
// Update balances
|
// Update balances
|
||||||
displayBalances(
|
displayBalances(
|
||||||
@ -24239,7 +24253,9 @@
|
|||||||
updateinDB(
|
updateinDB(
|
||||||
"crypto_balances",
|
"crypto_balances",
|
||||||
updateUserCryptoBalanceResponseObject.updatedBTCBalanceObject,
|
updateUserCryptoBalanceResponseObject.updatedBTCBalanceObject,
|
||||||
updateUserCryptoBalanceResponseObject.trader_flo_address
|
updateUserCryptoBalanceResponseObject.updatedBTCBalanceObject.id,
|
||||||
|
false,
|
||||||
|
false
|
||||||
);
|
);
|
||||||
if (
|
if (
|
||||||
localbitcoinplusplus.wallets.my_local_flo_address ==
|
localbitcoinplusplus.wallets.my_local_flo_address ==
|
||||||
@ -24281,7 +24297,10 @@
|
|||||||
if (isBalanceLegit) {
|
if (isBalanceLegit) {
|
||||||
updateinDB(
|
updateinDB(
|
||||||
"deposit",
|
"deposit",
|
||||||
updateUserDepositsResponseObject.updatedTraderDepositObject
|
updateUserDepositsResponseObject.updatedTraderDepositObject,
|
||||||
|
updateUserDepositsResponseObject.updatedTraderDepositObject.id,
|
||||||
|
false,
|
||||||
|
false
|
||||||
);
|
);
|
||||||
if (
|
if (
|
||||||
localbitcoinplusplus.wallets.my_local_flo_address ==
|
localbitcoinplusplus.wallets.my_local_flo_address ==
|
||||||
@ -25769,7 +25788,10 @@
|
|||||||
|
|
||||||
backup_server_db_instance.backup_updateinDB(
|
backup_server_db_instance.backup_updateinDB(
|
||||||
"cash_balances",
|
"cash_balances",
|
||||||
withdraw_success_response.withdrawer_cash_data
|
withdraw_success_response.withdrawer_cash_data,
|
||||||
|
withdraw_success_response.withdrawer_cash_data.id,
|
||||||
|
true,
|
||||||
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -26220,7 +26242,10 @@
|
|||||||
if (isBalanceLegit) {
|
if (isBalanceLegit) {
|
||||||
backup_server_db_instance.backup_updateinDB(
|
backup_server_db_instance.backup_updateinDB(
|
||||||
"crypto_balances",
|
"crypto_balances",
|
||||||
updateUserCryptoBalanceResponseObject.updatedBTCBalanceObject
|
updateUserCryptoBalanceResponseObject.updatedBTCBalanceObject,
|
||||||
|
updateUserCryptoBalanceResponseObject.updatedBTCBalanceObject.id,
|
||||||
|
true,
|
||||||
|
false
|
||||||
);
|
);
|
||||||
if (
|
if (
|
||||||
localbitcoinplusplus.wallets
|
localbitcoinplusplus.wallets
|
||||||
@ -26286,7 +26311,10 @@
|
|||||||
if (isBalanceLegit) {
|
if (isBalanceLegit) {
|
||||||
backup_server_db_instance.backup_updateinDB(
|
backup_server_db_instance.backup_updateinDB(
|
||||||
"deposit",
|
"deposit",
|
||||||
updateUserDepositsResponseObject.updatedTraderDepositObject
|
updateUserDepositsResponseObject.updatedTraderDepositObject,
|
||||||
|
updateUserDepositsResponseObject.updatedTraderDepositObject.id,
|
||||||
|
true,
|
||||||
|
false
|
||||||
);
|
);
|
||||||
if (
|
if (
|
||||||
localbitcoinplusplus.wallets.my_local_flo_address ==
|
localbitcoinplusplus.wallets.my_local_flo_address ==
|
||||||
@ -26323,8 +26351,7 @@
|
|||||||
localbitcoinplusplus.kademlia
|
localbitcoinplusplus.kademlia
|
||||||
.determineClosestSupernode(subjectuser)
|
.determineClosestSupernode(subjectuser)
|
||||||
.then(my_closest_su_list => {
|
.then(my_closest_su_list => {
|
||||||
const primarySupernodeOfThisUser =
|
const primarySupernodeOfThisUser = my_closest_su_list[0].data.id;
|
||||||
my_closest_su_list[0].data.id;
|
|
||||||
backup_server_db_instance =
|
backup_server_db_instance =
|
||||||
localbitcoinplusplus.newBackupDatabase.db[
|
localbitcoinplusplus.newBackupDatabase.db[
|
||||||
primarySupernodeOfThisUser
|
primarySupernodeOfThisUser
|
||||||
@ -26355,15 +26382,6 @@
|
|||||||
true,
|
true,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
if (
|
|
||||||
localbitcoinplusplus.wallets.my_local_flo_address ==
|
|
||||||
updateUserReservesResponseObject.trader_flo_address
|
|
||||||
) {
|
|
||||||
displayBalances(
|
|
||||||
updateUserReservesResponseObject.trader_flo_address
|
|
||||||
);
|
|
||||||
showMessage(`INFO: Your balance is updated.`);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
showMessage(
|
showMessage(
|
||||||
@ -27078,7 +27096,8 @@
|
|||||||
|
|
||||||
_updateinDB = foreign_db.backup_updateinDB.bind(foreign_db);
|
_updateinDB = foreign_db.backup_updateinDB.bind(foreign_db);
|
||||||
|
|
||||||
_updateinDB('withdraw_cash', successfull_withdraw_resp);
|
_updateinDB('withdraw_cash', successfull_withdraw_resp,
|
||||||
|
successfull_withdraw_resp.id, true, false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30010,7 +30029,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
trader_deposits.status = 2;
|
trader_deposits.status = 2;
|
||||||
_updateinDB(
|
const trader_deposit_updated = await _updateinDB(
|
||||||
"deposit",
|
"deposit",
|
||||||
trader_deposits,
|
trader_deposits,
|
||||||
trader_deposits.trader_flo_address
|
trader_deposits.trader_flo_address
|
||||||
@ -30073,7 +30092,7 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
const traderDepositsObjectString = JSON.stringify(
|
const traderDepositsObjectString = JSON.stringify(
|
||||||
trader_deposits
|
trader_deposit_updated
|
||||||
);
|
);
|
||||||
const traderDepositsObjectStringHash = Crypto.SHA256(
|
const traderDepositsObjectStringHash = Crypto.SHA256(
|
||||||
traderDepositsObjectString
|
traderDepositsObjectString
|
||||||
@ -30085,10 +30104,10 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
const updatedDepositObject = {
|
const updatedDepositObject = {
|
||||||
updatedTraderDepositObject: trader_deposits,
|
updatedTraderDepositObject: trader_deposit_updated,
|
||||||
updatedDepositsObjectSign: traderDepositsObjectSign,
|
updatedDepositsObjectSign: traderDepositsObjectSign,
|
||||||
trader_flo_address: trader_deposits.trader_flo_address,
|
trader_flo_address: trader_deposit_updated.trader_flo_address,
|
||||||
receiver_flo_address: trader_deposits.trader_flo_address
|
receiver_flo_address: trader_deposit_updated.trader_flo_address
|
||||||
};
|
};
|
||||||
|
|
||||||
RM_RPC.send_rpc(
|
RM_RPC.send_rpc(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user