diff --git a/BTCPayServer.Tests/docker-compose.yml b/BTCPayServer.Tests/docker-compose.yml
index 1e00495d8..8c2024ed4 100644
--- a/BTCPayServer.Tests/docker-compose.yml
+++ b/BTCPayServer.Tests/docker-compose.yml
@@ -37,7 +37,7 @@ services:
- postgres
nbxplorer:
- image: nicolasdorier/nbxplorer:1.0.0.58
+ image: nicolasdorier/nbxplorer:1.0.0.60
ports:
- "32838:32838"
expose:
diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj
index 7bf27c421..08ffb092d 100644
--- a/BTCPayServer/BTCPayServer.csproj
+++ b/BTCPayServer/BTCPayServer.csproj
@@ -2,7 +2,7 @@
Exe
netcoreapp2.0
- 1.0.0.71
+ 1.0.0.72
@@ -24,7 +24,7 @@
-
+
diff --git a/BTCPayServer/Events/NBXplorerStateChangedEvent.cs b/BTCPayServer/Events/NBXplorerStateChangedEvent.cs
index 5774140ff..15280bb19 100644
--- a/BTCPayServer/Events/NBXplorerStateChangedEvent.cs
+++ b/BTCPayServer/Events/NBXplorerStateChangedEvent.cs
@@ -6,6 +6,21 @@ using BTCPayServer.HostedServices;
namespace BTCPayServer.Events
{
+ public class NBXplorerErrorEvent
+ {
+ public NBXplorerErrorEvent(BTCPayNetwork network, string errorMessage)
+ {
+ Message = errorMessage;
+ Network = network;
+ }
+ public string Message { get; set; }
+ public BTCPayNetwork Network { get; set; }
+
+ public override string ToString()
+ {
+ return $"{Network.CryptoCode}: NBXplorer error `{Message}`";
+ }
+ }
public class NBXplorerStateChangedEvent
{
public NBXplorerStateChangedEvent(BTCPayNetwork network, NBXplorerState old, NBXplorerState newState)
diff --git a/BTCPayServer/HostedServices/NBXplorerWaiter.cs b/BTCPayServer/HostedServices/NBXplorerWaiter.cs
index d37e6b7bb..e25731f91 100644
--- a/BTCPayServer/HostedServices/NBXplorerWaiter.cs
+++ b/BTCPayServer/HostedServices/NBXplorerWaiter.cs
@@ -27,11 +27,12 @@ namespace BTCPayServer.HostedServices
public BTCPayNetwork Network { get; set; }
public NBXplorerState State { get; set; }
public StatusResult Status { get; set; }
+ public string Error { get; set; }
}
ConcurrentDictionary _Summaries = new ConcurrentDictionary();
- public void Publish(BTCPayNetwork network, NBXplorerState state, StatusResult status)
+ public void Publish(BTCPayNetwork network, NBXplorerState state, StatusResult status, string error)
{
- var summary = new NBXplorerSummary() { Network = network, State = state, Status = status };
+ var summary = new NBXplorerSummary() { Network = network, State = state, Status = status, Error = error };
_Summaries.AddOrUpdate(network.CryptoCode, summary, (k, v) => summary);
}
@@ -120,6 +121,7 @@ namespace BTCPayServer.HostedServices
private async Task StepAsync(CancellationToken cancellation)
{
var oldState = State;
+ string error = null;
StatusResult status = null;
try
{
@@ -164,15 +166,28 @@ namespace BTCPayServer.HostedServices
}
}
- catch when (cancellation.IsCancellationRequested)
+ catch (Exception ex) when (!cancellation.IsCancellationRequested)
{
-
+ error = ex.Message;
}
- catch (Exception ex)
+
+
+ if(status == null && error == null)
+ error = $"{_Network.CryptoCode}: NBXplorer does not support this cryptocurrency";
+
+ if(status != null && error == null)
+ {
+ if(status.ChainType != _Network.NBXplorerNetwork.DefaultSettings.ChainType)
+ error = $"{_Network.CryptoCode}: NBXplorer is on a different ChainType (actual: {status.ChainType}, expected: {_Network.NBXplorerNetwork.DefaultSettings.ChainType})";
+ }
+
+ if (error != null)
{
State = NBXplorerState.NotConnected;
- Logs.PayServer.LogError(ex, $"Error while trying to connect to NBXplorer ({_Network.CryptoCode})");
+ status = null;
+ _Aggregator.Publish(new NBXplorerErrorEvent(_Network, error));
}
+
if (oldState != State)
{
if (State == NBXplorerState.Synching)
@@ -185,7 +200,7 @@ namespace BTCPayServer.HostedServices
}
_Aggregator.Publish(new NBXplorerStateChangedEvent(_Network, oldState, State));
}
- _Dashboard.Publish(_Network, State, status);
+ _Dashboard.Publish(_Network, State, status, error);
return oldState != State;
}
diff --git a/BTCPayServer/Properties/launchSettings.json b/BTCPayServer/Properties/launchSettings.json
index d0b75641b..27ceb5f3a 100644
--- a/BTCPayServer/Properties/launchSettings.json
+++ b/BTCPayServer/Properties/launchSettings.json
@@ -9,20 +9,21 @@
},
"profiles": {
"Default": {
- "commandName": "Project"
+ "commandName": "Project",
+ "commandLineArgs": "--network testnet --chains ltc --ltcexplorerurl http://127.0.0.1:2727/"
},
"Docker-Regtest": {
"commandName": "Project",
"launchBrowser": true,
- "environmentVariables": {
- "BTCPAY_NETWORK": "regtest",
- "BTCPAY_CHAINS": "btc,ltc",
- "BTCPAY_LTCEXPLORERURL": "http://127.0.0.1:32838/",
- "BTCPAY_BTCEXPLORERURL": "http://127.0.0.1:32838/",
- "ASPNETCORE_ENVIRONMENT": "Development",
- "BTCPAY_POSTGRES": "User ID=postgres;Host=127.0.0.1;Port=39372;Database=btcpayserver"
- },
+ "environmentVariables": {
+ "BTCPAY_NETWORK": "regtest",
+ "BTCPAY_LTCEXPLORERURL": "http://127.0.0.1:32838/",
+ "BTCPAY_BTCEXPLORERURL": "http://127.0.0.1:32838/",
+ "ASPNETCORE_ENVIRONMENT": "Development",
+ "BTCPAY_CHAINS": "btc,ltc",
+ "BTCPAY_POSTGRES": "User ID=postgres;Host=127.0.0.1;Port=39372;Database=btcpayserver"
+ },
"applicationUrl": "http://localhost:14142/"
}
}
-}
+}
\ No newline at end of file
diff --git a/BTCPayServer/Views/Shared/_Layout.cshtml b/BTCPayServer/Views/Shared/_Layout.cshtml
index b718a2476..491ded1bb 100644
--- a/BTCPayServer/Views/Shared/_Layout.cshtml
+++ b/BTCPayServer/Views/Shared/_Layout.cshtml
@@ -103,7 +103,13 @@
@line.Network.CryptoCode
@if(line.Status == null)
{
- NBXplorer is offline
+
+ - The node is offline
+ @if(line.Error != null)
+ {
+ - Last error: @line.Error
+ }
+
}
else
{
@@ -118,11 +124,21 @@
else
{
The node is offline
+ @if(line.Error != null)
+ {
+ Last error: @line.Error
+ }
}
}
else if(line.Status.BitcoinStatus.IsSynched)
{
- The node is synched
+ The node is synched (Height: @line.Status.BitcoinStatus.Headers)
+ @if(line.Status.BitcoinStatus.IsSynched &&
+ line.Status.SyncHeight.HasValue &&
+ line.Status.SyncHeight.Value < line.Status.BitcoinStatus.Headers)
+ {
+ NBXplorer is synching... (Height: @line.Status.SyncHeight.Value)
+ }
}
else
{