FIX: incorrect fees occasionally (for some electrum servers); better fee estimation

This commit is contained in:
overtorment 2023-09-28 20:13:06 +01:00
parent ab9ac9a8a2
commit ba737f9cf2
2 changed files with 8 additions and 1 deletions

View File

@ -857,6 +857,13 @@ module.exports.estimateFees = async function () {
const _medium = await module.exports.estimateFee(18);
const _slow = await module.exports.estimateFee(144);
/**
* sanity check, see
* @see https://github.com/cculianu/Fulcrum/issues/197
* (fallback to bitcoin core estimates)
*/
if (!histogram || histogram?.[0]?.[0] > 1000) return { fast: _fast, medium: _medium, slow: _slow };
// calculating fast fees from mempool:
const fast = Math.max(2, module.exports.calcEstimateFeeFromFeeHistorgam(1, histogram));
// recalculating medium and slow fees using bitcoincore estimations only like relative weights:

View File

@ -28,7 +28,7 @@ export default class NetworkTransactionFees {
}
const response = await BlueElectrum.estimateFees();
if (typeof response === 'object') {
const networkFee = new NetworkTransactionFee(response.fast, response.medium, response.slow);
const networkFee = new NetworkTransactionFee(response.fast + 5, response.medium + 2, response.slow);
resolve(networkFee);
} else {
const networkFee = new NetworkTransactionFee(2, 1, 1);