btcpayserver/BTCPayServer/Services/Fees/NBxplorerFeeProvider.cs
Andrew Camilleri 75bf8a5086
Use Mempoolspace fees (#5490)
* Use Mempoolspace fees

Since bitcoind's fee estiomates are horrible, I would use an altenrative, but that adds a third party to the mix. We can either:
* Accept the risk (it is only for fee estimation anyway)
* Offer a toggle in the server settings
* Move this code to a plugin

* refactor

* Refactor

---------

Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
2023-11-28 18:26:35 +09:00

16 lines
441 B
C#

#nullable enable
using System.Threading.Tasks;
using NBitcoin;
using NBXplorer;
using NBXplorer.Models;
namespace BTCPayServer.Services.Fees
{
public class NBXplorerFeeProvider(ExplorerClient ExplorerClient) : IFeeProvider
{
public async Task<FeeRate> GetFeeRateAsync(int blockTarget = 20)
{
return (await ExplorerClient.GetFeeRateAsync(blockTarget).ConfigureAwait(false)).FeeRate;
}
}
}