diff --git a/BTCPayServer.Client/Models/ServerInfoData.cs b/BTCPayServer.Client/Models/ServerInfoData.cs index 382456efd..a563c5945 100644 --- a/BTCPayServer.Client/Models/ServerInfoData.cs +++ b/BTCPayServer.Client/Models/ServerInfoData.cs @@ -4,11 +4,6 @@ namespace BTCPayServer.Client.Models { public class ServerInfoData { - /// - /// detailed status information - /// - public ServerInfoStatusData Status { get; set; } - /// /// the BTCPay Server version /// @@ -23,15 +18,12 @@ namespace BTCPayServer.Client.Models /// the payment methods this server supports /// public IEnumerable SupportedPaymentMethods { get; set; } - } - public class ServerInfoStatusData - { /// /// are all chains fully synched /// public bool FullySynched { get; set; } - + /// /// detailed sync information per chain /// @@ -41,7 +33,15 @@ namespace BTCPayServer.Client.Models public class ServerInfoSyncStatusData { public string CryptoCode { get; set; } - public int BlockHeaders { get; set; } - public float Progress { get; set; } + public int ChainHeight { get; set; } + public int? SyncHeight { get; set; } + public ServerInfoNodeData NodeInformation { get; set; } + } + + public class ServerInfoNodeData + { + public int Headers { get; set; } + public int Blocks { get; set; } + public double VerificationProgress { get; set; } } } diff --git a/BTCPayServer.Tests/GreenfieldAPITests.cs b/BTCPayServer.Tests/GreenfieldAPITests.cs index a9317c5c9..c681686e0 100644 --- a/BTCPayServer.Tests/GreenfieldAPITests.cs +++ b/BTCPayServer.Tests/GreenfieldAPITests.cs @@ -345,12 +345,11 @@ namespace BTCPayServer.Tests Assert.NotNull(serverInfoData); Assert.NotNull(serverInfoData.Version); Assert.NotNull(serverInfoData.Onion); - Assert.NotNull(serverInfoData.Status); - Assert.True(serverInfoData.Status.FullySynched); + Assert.True(serverInfoData.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")); + Assert.NotNull(serverInfoData.SyncStatus); + Assert.Single(serverInfoData.SyncStatus.Select(s => s.CryptoCode == "BTC")); } } @@ -428,7 +427,7 @@ namespace BTCPayServer.Tests [Fact(Timeout = TestTimeout)] [Trait("Fast", "Fast")] - public async Task DecimalStringJsonConverterTests() + public void DecimalStringJsonConverterTests() { JsonReader Get(string val) { diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj index c37a38ca5..71d09ccd0 100644 --- a/BTCPayServer/BTCPayServer.csproj +++ b/BTCPayServer/BTCPayServer.csproj @@ -223,5 +223,5 @@ <_ContentIncludedByDefault Remove="Views\Authorization\Authorize.cshtml" /> - + diff --git a/BTCPayServer/Controllers/GreenField/ServerInfoController.cs b/BTCPayServer/Controllers/GreenField/ServerInfoController.cs index 4b8f0a820..9cfd09789 100644 --- a/BTCPayServer/Controllers/GreenField/ServerInfoController.cs +++ b/BTCPayServer/Controllers/GreenField/ServerInfoController.cs @@ -10,6 +10,7 @@ using BTCPayServer.Services.Stores; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; +using NBXplorer.Models; namespace BTCPayServer.Controllers.GreenField { @@ -52,17 +53,19 @@ namespace BTCPayServer.Controllers.GreenField .Select(summary => new ServerInfoSyncStatusData { CryptoCode = summary.Network.CryptoCode, - BlockHeaders = summary.Status.ChainHeight, - Progress = summary.Status.SyncHeight.GetValueOrDefault(0) / (float)summary.Status.ChainHeight + NodeInformation = summary.Status.BitcoinStatus is BitcoinStatus s ? new ServerInfoNodeData() + { + Headers = s.Headers, + Blocks = s.Blocks, + VerificationProgress = s.VerificationProgress + }: null, + ChainHeight = summary.Status.ChainHeight, + SyncHeight = summary.Status.SyncHeight }); - ServerInfoStatusData status = new ServerInfoStatusData - { - FullySynched = _dashBoard.IsFullySynched(), - SyncStatus = syncStatus - }; ServerInfoData model = new ServerInfoData { - Status = status, + FullySynched = _dashBoard.IsFullySynched(), + SyncStatus = syncStatus, Onion = _env.OnionUrl, Version = _env.Version, SupportedPaymentMethods = supportedPaymentMethods diff --git a/BTCPayServer/wwwroot/swagger/v1/swagger.template.serverinfo.json b/BTCPayServer/wwwroot/swagger/v1/swagger.template.serverinfo.json index c1ef20713..c216695c1 100644 --- a/BTCPayServer/wwwroot/swagger/v1/swagger.template.serverinfo.json +++ b/BTCPayServer/wwwroot/swagger/v1/swagger.template.serverinfo.json @@ -34,9 +34,6 @@ "ApplicationServerInfoData": { "type": "object", "properties": { - "status": { - "$ref": "#/components/schemas/ApplicationServerInfoStatusData" - }, "version": { "type": "string", "description": "BTCPay Server version" @@ -51,13 +48,7 @@ "items": { "type": "string" } - } - } - }, - "ApplicationServerInfoStatusData": { - "type": "object", - "description": "Detailed sync status", - "properties": { + }, "fullySynched": { "type": "boolean", "description": "True if the instance is fully synchronized, according to NBXplorer" @@ -70,22 +61,48 @@ } } }, + "ApplicationServerInfoNodeStatusData": { + "type": "object", + "nullable": true, + "description": "Detailed sync status of the internal full node", + "properties": { + "headers": { + "type": "integer", + "description": "The height of the chain of header of the internal full node" + }, + "blocks": { + "type": "integer", + "description": "The height of the latest validated block of the internal full node" + }, + "verificationProgress": { + "type": "number", + "format": "double", + "minimum": 0.0, + "maximum": 1.0, + "description": "The current synchronization progress" + } + } + }, "ApplicationServerInfoSyncStatusData": { "type": "object", "description": "Detailed sync status", "properties": { "cryptoCode": { "type": "string", - "description": "True if the instance is fully synchronized, according to NBXplorer" + "description": "The CryptoCode of the crypto currency (eg. BTC)" }, - "blockHeaders": { + "nodeInformation": { + "$ref": "#/components/schemas/ApplicationServerInfoNodeStatusData" + }, + "chainHeight": { "type": "integer", - "description": "True if the instance is fully synchronized, according to NBXplorer" + "description": "The height of the chain of header of the internal indexer" }, - "progress": { + "syncHeight": { "type": "number", - "format": "double", - "description": "True if the instance is fully synchronized, according to NBXplorer" + "format": "integer", + "nullable": true, + "description": "The height of the latest indexed block of the internal indexer" } } } diff --git a/amd64.Dockerfile b/amd64.Dockerfile index 6d167f108..db37fb6f6 100644 --- a/amd64.Dockerfile +++ b/amd64.Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/core/sdk:3.1.101 AS builder +FROM mcr.microsoft.com/dotnet/core/sdk:3.1.202 AS builder WORKDIR /source COPY nuget.config nuget.config COPY Build/Common.csproj Build/Common.csproj @@ -16,7 +16,7 @@ COPY BTCPayServer/. BTCPayServer/. COPY Build/Version.csproj Build/Version.csproj RUN cd BTCPayServer && dotnet publish --output /app/ --configuration Release -FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.1-buster-slim +FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.4-buster-slim RUN apt-get update && apt-get install -y --no-install-recommends iproute2 openssh-client \ && rm -rf /var/lib/apt/lists/* diff --git a/arm32v7.Dockerfile b/arm32v7.Dockerfile index cfd8d458b..144bde2d0 100644 --- a/arm32v7.Dockerfile +++ b/arm32v7.Dockerfile @@ -1,5 +1,5 @@ # This is a manifest image, will pull the image with the same arch as the builder machine -FROM mcr.microsoft.com/dotnet/core/sdk:3.1.101 AS builder +FROM mcr.microsoft.com/dotnet/core/sdk:3.1.202 AS builder RUN apt-get update \ && apt-get install -qq --no-install-recommends qemu qemu-user-static qemu-user binfmt-support @@ -21,7 +21,7 @@ COPY Build/Version.csproj Build/Version.csproj RUN cd BTCPayServer && dotnet publish --output /app/ --configuration Release # Force the builder machine to take make an arm runtime image. This is fine as long as the builder does not run any program -FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.1-buster-slim-arm32v7 +FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.4-buster-slim-arm32v7 COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static RUN apt-get update && apt-get install -y --no-install-recommends iproute2 openssh-client \ && rm -rf /var/lib/apt/lists/* diff --git a/arm64v8.Dockerfile b/arm64v8.Dockerfile index 5370b6730..30fd3a894 100644 --- a/arm64v8.Dockerfile +++ b/arm64v8.Dockerfile @@ -1,5 +1,5 @@ # This is a manifest image, will pull the image with the same arch as the builder machine -FROM mcr.microsoft.com/dotnet/core/sdk:3.1.101 AS builder +FROM mcr.microsoft.com/dotnet/core/sdk:3.1.202 AS builder RUN apt-get update \ && apt-get install -qq --no-install-recommends qemu qemu-user-static qemu-user binfmt-support @@ -21,7 +21,7 @@ COPY Build/Version.csproj Build/Version.csproj RUN cd BTCPayServer && dotnet publish --output /app/ --configuration Release # Force the builder machine to take make an arm runtime image. This is fine as long as the builder does not run any program -FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.1-buster-slim-arm64v8 +FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.4-buster-slim-arm64v8 COPY --from=builder /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static RUN apt-get update && apt-get install -y --no-install-recommends iproute2 openssh-client \ && rm -rf /var/lib/apt/lists/*