From 49d5c2411c28a8781f2abc1f80974d8bade34d35 Mon Sep 17 00:00:00 2001 From: sairajzero Date: Thu, 1 Jun 2023 21:09:50 +0530 Subject: [PATCH] btcOperator v1.1.3b: fix - Fixed: fee increment minimum value Minimum fee increment should be atleast MIN_FEE_UPDATE (219 satoshi) --- btcOperator.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/btcOperator.js b/btcOperator.js index 6d45a62..2abb80f 100644 --- a/btcOperator.js +++ b/btcOperator.js @@ -1,11 +1,12 @@ -(function (EXPORTS) { //btcOperator v1.1.3a +(function (EXPORTS) { //btcOperator v1.1.3b /* BTC Crypto and API Operator */ const btcOperator = EXPORTS; //This library uses API provided by chain.so (https://chain.so/) const URL = "https://blockchain.info/"; - const DUST_AMT = 546; + const DUST_AMT = 546, + MIN_FEE_UPDATE = 219; const fetch_api = btcOperator.fetch = function (api, json_res = true) { return new Promise((resolve, reject) => { @@ -576,6 +577,8 @@ //edit output values to increase fee let inc_fee = util.BTC_to_Sat(new_fee - tx_parsed.fee); + if (inc_fee < MIN_FEE_UPDATE) + return reject(`Insufficient additional fee. Minimum increment: ${MIN_FEE_UPDATE}`); for (let i = tx.outs.length - 1; i >= 0 && inc_fee > 0; i--) //reduce in reverse order if (edit_output_address.has(tx_parsed.outputs[i].address)) { let current_value = tx.outs[i].value;