mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-01-19 05:45:15 +01:00
FIX: incorrect fees occasionally (for some electrum servers); better fee estimation
This commit is contained in:
parent
ab9ac9a8a2
commit
ba737f9cf2
@ -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:
|
||||
|
@ -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);
|
Loading…
Reference in New Issue
Block a user