Make sure tests use fixed fees

This commit is contained in:
nicolas.dorier 2020-04-06 19:18:49 +09:00
parent 7ce614f1c4
commit 1e0587af26
No known key found for this signature in database
GPG key ID: 6618763EF09186FE
2 changed files with 12 additions and 1 deletions

View file

@ -1,4 +1,6 @@
using BTCPayServer.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using System.Linq;
using BTCPayServer.HostedServices;
using BTCPayServer.Hosting;
@ -179,6 +181,10 @@ namespace BTCPayServer.Tests
.AddProvider(Logs.LogProvider);
});
})
.ConfigureServices(services =>
{
services.TryAddSingleton<IFeeProviderFactory>(new BTCPayServer.Services.Fees.FixedFeeProvider(new FeeRate(100L, 1)));
})
.UseKestrel()
.UseStartup<Startup>()
.Build();

View file

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace BTCPayServer.Services.Fees
{
public class FixedFeeProvider : IFeeProvider
public class FixedFeeProvider : IFeeProvider, IFeeProviderFactory
{
public FixedFeeProvider(FeeRate feeRate)
{
@ -18,6 +18,11 @@ namespace BTCPayServer.Services.Fees
get; set;
}
public IFeeProvider CreateFeeProvider(BTCPayNetworkBase network)
{
return new FixedFeeProvider(FeeRate);
}
public Task<FeeRate> GetFeeRateAsync(int blockTarget)
{
return Task.FromResult(FeeRate);