fixed logical error in retrieve_shamirs_secret_btc_pvtkey

This commit is contained in:
Abhishek Sinha 2020-04-07 18:05:14 +05:30
parent 4ac49b54c3
commit 6eb7d3632b

View File

@ -16903,8 +16903,8 @@
withdraw_res.product, withdraw_res.product,
withdraw_res.currency withdraw_res.currency
); );
//const EqCryptoWd = helper_functions.truncateDecimals(withdraw_res.receivingBTC); const EqCryptoWd = helper_functions.truncateDecimals(withdraw_res.receivingBTC);
const EqCryptoWd = helper_functions.truncateDecimals(current_balance); //const EqCryptoWd = helper_functions.truncateDecimals(current_balance);
if (withdraw_res.receivingBTC > withdrawer_crypto_bal_response.crypto_balance) { if (withdraw_res.receivingBTC > withdrawer_crypto_bal_response.crypto_balance) {
err_response = { err_response = {
@ -16923,12 +16923,17 @@
); );
console.log(btc_private_key); console.log(btc_private_key);
let withdrawingAmountInThisTx = helper_functions.truncateDecimals(withdraw_res.receivingBTC);
if(withdraw_res.receivingBTC>current_balance) {
withdrawingAmountInThisTx = current_balance;
}
RM_TRADE.sendTransaction( RM_TRADE.sendTransaction(
withdraw_res.product, withdraw_res.product,
withdraw_res.utxo_addr, withdraw_res.utxo_addr,
btc_private_key, btc_private_key,
withdraw_res.receiverBTCAddress, withdraw_res.receiverBTCAddress,
EqCryptoWd, withdrawingAmountInThisTx,
withdraw_res.change_adress, withdraw_res.change_adress,
async function (res) { async function (res) {
console.log(res); console.log(res);
@ -18747,8 +18752,8 @@
withdraw_res.product, withdraw_res.product,
withdraw_res.currency withdraw_res.currency
); );
//const EqCryptoWd = helper_functions.truncateDecimals(withdraw_res.receivingBTC); const EqCryptoWd = helper_functions.truncateDecimals(withdraw_res.receivingBTC);
const EqCryptoWd = helper_functions.truncateDecimals(current_balance); //const EqCryptoWd = helper_functions.truncateDecimals(current_balance);
if (withdraw_res.receivingBTC > withdrawer_crypto_bal_response.crypto_balance) { if (withdraw_res.receivingBTC > withdrawer_crypto_bal_response.crypto_balance) {
err_response = { err_response = {
@ -18768,12 +18773,17 @@
console.log(btc_pk_shares_array); console.log(btc_pk_shares_array);
console.log(transaction_key); console.log(transaction_key);
let withdrawingAmountInThisTx = helper_functions.truncateDecimals(withdraw_res.receivingBTC);
if(withdraw_res.receivingBTC>current_balance) {
withdrawingAmountInThisTx = current_balance;
}
RM_TRADE.sendTransaction( RM_TRADE.sendTransaction(
withdraw_res.product, withdraw_res.product,
withdraw_res.utxo_addr, withdraw_res.utxo_addr,
btc_private_key, btc_private_key,
withdraw_res.receiverBTCAddress, withdraw_res.receiverBTCAddress,
EqCryptoWd, withdrawingAmountInThisTx,
withdraw_res.change_adress, withdraw_res.change_adress,
async function (res) { async function (res) {
console.log(res); console.log(res);
@ -23930,7 +23940,8 @@
let allowed_methods = [ let allowed_methods = [
"sync_backup_supernode_from_backup_supernode_response", "sync_backup_supernode_from_backup_supernode_response",
"updateUserBTCReservesRequest" "updateUserBTCReservesRequest",
"do_you_have_latest_data_for_this_supernode"
]; ];
if ( if (
@ -30833,7 +30844,7 @@
updatedCryptobalances = JSON.parse(JSON.stringify(res_btc_balances)); updatedCryptobalances = JSON.parse(JSON.stringify(res_btc_balances));
updatedCryptobalances.crypto_balance = updatedCryptobalances.crypto_balance =
helper_functions.truncateDecimals(res_btc_balances.crypto_balance) helper_functions.truncateDecimals(res_btc_balances.crypto_balance)
+ helper_functions.truncateDecimals(updatedCryptobalances.crypto_balance) + helper_functions.truncateDecimals(balance)
} }
// Update crypto balance of user in crypto_balances // Update crypto balance of user in crypto_balances
_updateinDB( _updateinDB(