mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 09:54:30 +01:00
Make sure cheater scan rpc capabilities
This commit is contained in:
parent
601e17ed0f
commit
6c688b9684
@ -443,6 +443,7 @@ namespace BTCPayServer.Hosting
|
||||
if (configuration.GetOrDefault<bool>("cheatmode", false))
|
||||
{
|
||||
services.AddSingleton<Cheater>();
|
||||
services.AddSingleton<IHostedService, Cheater>(o => o.GetRequiredService<Cheater>());
|
||||
}
|
||||
return services;
|
||||
}
|
||||
|
@ -1,15 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Configuration;
|
||||
using BTCPayServer.Data;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using NBitcoin;
|
||||
using NBitcoin.RPC;
|
||||
|
||||
namespace BTCPayServer.Services
|
||||
{
|
||||
public class Cheater
|
||||
public class Cheater : IHostedService
|
||||
{
|
||||
private readonly ApplicationDbContextFactory _applicationDbContextFactory;
|
||||
|
||||
@ -35,5 +37,15 @@ namespace BTCPayServer.Services
|
||||
await ctx.SaveChangesAsync().ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
async Task IHostedService.StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
await CashCow.ScanRPCCapabilitiesAsync();
|
||||
}
|
||||
|
||||
Task IHostedService.StopAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user