mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 09:54:30 +01:00
Add sync state
This commit is contained in:
parent
e3b348b55c
commit
3b6dbe76c5
@ -42,6 +42,6 @@ namespace BTCPayServer.Client.Models
|
||||
{
|
||||
public string CryptoCode { get; set; }
|
||||
public int BlockHeaders { get; set; }
|
||||
public double Progress { get; set; }
|
||||
public float Progress { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -4,11 +4,8 @@ using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Client;
|
||||
using BTCPayServer.Client.Models;
|
||||
using BTCPayServer.Controllers;
|
||||
using BTCPayServer.Services;
|
||||
using BTCPayServer.Tests.Logging;
|
||||
using Microsoft.AspNet.SignalR.Client;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using CreateApplicationUserRequest = BTCPayServer.Client.Models.CreateApplicationUserRequest;
|
||||
@ -306,11 +303,18 @@ namespace BTCPayServer.Tests
|
||||
user.GrantAccess();
|
||||
var clientBasic = await user.CreateClient();
|
||||
var serverInfoData = await clientBasic.GetServerInfo();
|
||||
|
||||
Assert.NotNull(serverInfoData);
|
||||
Assert.NotNull(serverInfoData.Version);
|
||||
Assert.NotNull(serverInfoData.Onion);
|
||||
Assert.NotNull(serverInfoData.Status);
|
||||
|
||||
Assert.True(serverInfoData.Status.FullySynched);
|
||||
Assert.Contains("BTC", serverInfoData.SupportedPaymentMethods);
|
||||
Assert.Contains("BTC_LightningLike", serverInfoData.SupportedPaymentMethods);
|
||||
|
||||
Assert.NotNull(serverInfoData.Status.SyncStatus);
|
||||
Assert.Single(serverInfoData.Status.SyncStatus.Select(s => s.CryptoCode == "BTC"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,9 +51,8 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
.Select(summary => new ServerInfoSyncStatusData
|
||||
{
|
||||
CryptoCode = summary.Network.CryptoCode,
|
||||
// TODO: Implement these fields
|
||||
BlockHeaders = 0,
|
||||
Progress = 0
|
||||
BlockHeaders = summary.Status.ChainHeight,
|
||||
Progress = summary.Status.SyncHeight.GetValueOrDefault(0) / (float)summary.Status.ChainHeight
|
||||
});
|
||||
ServerInfoStatusData status = new ServerInfoStatusData
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user