btcOperator v1.1.3b: fix
- Fixed: fee increment minimum value Minimum fee increment should be atleast MIN_FEE_UPDATE (219 satoshi)
This commit is contained in:
parent
365d3d4503
commit
49d5c2411c
@ -1,11 +1,12 @@
|
|||||||
(function (EXPORTS) { //btcOperator v1.1.3a
|
(function (EXPORTS) { //btcOperator v1.1.3b
|
||||||
/* BTC Crypto and API Operator */
|
/* BTC Crypto and API Operator */
|
||||||
const btcOperator = EXPORTS;
|
const btcOperator = EXPORTS;
|
||||||
|
|
||||||
//This library uses API provided by chain.so (https://chain.so/)
|
//This library uses API provided by chain.so (https://chain.so/)
|
||||||
const URL = "https://blockchain.info/";
|
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) {
|
const fetch_api = btcOperator.fetch = function (api, json_res = true) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@ -576,6 +577,8 @@
|
|||||||
|
|
||||||
//edit output values to increase fee
|
//edit output values to increase fee
|
||||||
let inc_fee = util.BTC_to_Sat(new_fee - tx_parsed.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
|
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)) {
|
if (edit_output_address.has(tx_parsed.outputs[i].address)) {
|
||||||
let current_value = tx.outs[i].value;
|
let current_value = tx.outs[i].value;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user