mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 14:04:26 +01:00
Add sync state
This commit is contained in:
@@ -42,6 +42,6 @@ namespace BTCPayServer.Client.Models
|
|||||||
{
|
{
|
||||||
public string CryptoCode { get; set; }
|
public string CryptoCode { get; set; }
|
||||||
public int BlockHeaders { 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 System.Threading.Tasks;
|
||||||
using BTCPayServer.Client;
|
using BTCPayServer.Client;
|
||||||
using BTCPayServer.Client.Models;
|
using BTCPayServer.Client.Models;
|
||||||
using BTCPayServer.Controllers;
|
|
||||||
using BTCPayServer.Services;
|
using BTCPayServer.Services;
|
||||||
using BTCPayServer.Tests.Logging;
|
using BTCPayServer.Tests.Logging;
|
||||||
using Microsoft.AspNet.SignalR.Client;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
using CreateApplicationUserRequest = BTCPayServer.Client.Models.CreateApplicationUserRequest;
|
using CreateApplicationUserRequest = BTCPayServer.Client.Models.CreateApplicationUserRequest;
|
||||||
@@ -306,11 +303,18 @@ namespace BTCPayServer.Tests
|
|||||||
user.GrantAccess();
|
user.GrantAccess();
|
||||||
var clientBasic = await user.CreateClient();
|
var clientBasic = await user.CreateClient();
|
||||||
var serverInfoData = await clientBasic.GetServerInfo();
|
var serverInfoData = await clientBasic.GetServerInfo();
|
||||||
|
|
||||||
Assert.NotNull(serverInfoData);
|
Assert.NotNull(serverInfoData);
|
||||||
|
Assert.NotNull(serverInfoData.Version);
|
||||||
|
Assert.NotNull(serverInfoData.Onion);
|
||||||
Assert.NotNull(serverInfoData.Status);
|
Assert.NotNull(serverInfoData.Status);
|
||||||
|
|
||||||
Assert.True(serverInfoData.Status.FullySynched);
|
Assert.True(serverInfoData.Status.FullySynched);
|
||||||
Assert.Contains("BTC", serverInfoData.SupportedPaymentMethods);
|
Assert.Contains("BTC", serverInfoData.SupportedPaymentMethods);
|
||||||
Assert.Contains("BTC_LightningLike", 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
|
.Select(summary => new ServerInfoSyncStatusData
|
||||||
{
|
{
|
||||||
CryptoCode = summary.Network.CryptoCode,
|
CryptoCode = summary.Network.CryptoCode,
|
||||||
// TODO: Implement these fields
|
BlockHeaders = summary.Status.ChainHeight,
|
||||||
BlockHeaders = 0,
|
Progress = summary.Status.SyncHeight.GetValueOrDefault(0) / (float)summary.Status.ChainHeight
|
||||||
Progress = 0
|
|
||||||
});
|
});
|
||||||
ServerInfoStatusData status = new ServerInfoStatusData
|
ServerInfoStatusData status = new ServerInfoStatusData
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user