dgarage / NBXplorer

NBitcoin Explorer
MIT License
319 stars 212 forks source link

NBXplorer update to 2.3.45 crashed sync / seems to work after btcpay-restart.sh #384

Closed petzsch closed 1 year ago

petzsch commented 1 year ago

The issue hopefully permanently resolved after a btcpay restart. Running on a RPI4 8GB with native btcpay docker deploy.

root@cryptonode:~# docker logs generated_nbxplorer_1 
info: Configuration:  Data Directory: /datadir
info: Configuration:  Configuration File: /datadir/Main/settings.config
info: Configuration:  Network: Mainnet
info: Configuration:  Supported chains: BTC
info: Configuration:  DBCache: 50 MB
info: Configuration:  Network: Mainnet
info: Configuration:  Supported chains: BTC
info: Configuration:  DBCache: 50 MB
info: NBXplorer.DatabaseSetup: Postgres services activated
info: Explorer:       Trimming the event table if needed...
info: Explorer:       Trimmed 129 events in total...
warn: NBXplorer.PostgresMigration: A legacy DBTrie database has been previously migrated to postgres and is still present. You can safely delete it if you do not expect using it in the future. To delete the old DBTrie database, start NBXplorer with --deleteaftermigration (or environment variable: NBXPLORER_DELETEAFTERMIGRATION=1)
info: NBXplorer.Indexer.BTC: TCP Connection succeed, handshaking...
Hosting environment: Production
Content root path: /app/
Now listening on: http://0.0.0.0:32838
Application started. Press Ctrl+C to shut down.
info: NBXplorer.Indexer.BTC: Handshaked
info: NBXplorer.Indexer.BTC: Testing RPC connection to http://bitcoind:43782/
info: NBXplorer.Indexer.BTC: RPC connection successful
info: NBXplorer.Indexer.BTC: Full node version detected: 230000
info: NBXplorer.Indexer.BTC: NBXplorer is correctly whitelisted by the node
info: NBXplorer.Events: BTC: Node state changed: NotStarted => NBXplorerSynching
info: NBXplorer.Events: BTC: Node state changed: NBXplorerSynching => Ready
info: NBXplorer.Events: BTC: New block 000000000000000000001e9c08144aea29eda0cf1afeeedbd99dc397f5dd8f08 (763173)
info: NBXplorer.Events: BTC: New block 0000000000000000000725f99e17e92a4f4bea0ea81b5aecf9d9f19a09cb1b78 (763174)
root@cryptonode:~# docker logs 
btcpayserver_bitcoind                  generated_btcpayserver_1               generated_clightning_bitcoin_spark_1   generated_postgres_1                   nginx-gen
btcpayserver_clightning_bitcoin        generated_clightning_bitcoin_charge_1  generated_electrumx_1                  letsencrypt-nginx-proxy-companion      tor
generated_bitcoin_rtl_1                generated_clightning_bitcoin_rest_1    generated_nbxplorer_1                  nginx                                  tor-gen
root@cryptonode:~# docker logs generated_btcpayserver_1 
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
info: Configuration:  Data Directory: /datadir
info: Configuration:  Configuration File: /datadir/Main/settings.config
info: BTCPayServer.Plugins.PluginManager: Loading plugins from /root/.btcpayserver/Plugins
info: BTCPayServer.Plugins.PluginManager: Adding and executing plugin BTCPayServer - 1.6.12.0
info: BTCPayServer.Plugins.PluginManager: Adding and executing plugin BTCPayServer.Plugins.Shopify - 1.6.12.0
info: BTCPayServer.Plugins.PluginManager: Adding and executing plugin BTCPayServer.Plugins.Crowdfund - 1.6.12.0
info: BTCPayServer.Plugins.PluginManager: Adding and executing plugin BTCPayServer.Plugins.PayButton - 1.6.12.0
info: BTCPayServer.Plugins.PluginManager: Adding and executing plugin BTCPayServer.Plugins.PointOfSale - 1.6.12.0
info: BTCPayServer.Plugins.PluginManager: Adding and executing plugin BTCPayServer.Plugins.NFC - 1.0.5.0
info: BTCPayServer.Plugins.PluginManager: Adding and executing plugin BTCPayServer.Plugins.BitcoinWhitepaper - 1.0.1.0
info: BTCPayServer.Plugins.PluginManager: Adding and executing plugin BTCPayServer.Plugins.LNbank - 1.3.4.0
info: Configuration:  Supported chains: BTC
info: Configuration:  BTC: Explorer url is http://nbxplorer:32838/
info: Configuration:  BTC: Cookie file is /root/.nbxplorer/Main/.cookie
info: Configuration:  Network: Mainnet
info: Configuration:  LogFile: /datadir/btcpay.log
info: Configuration:  Log Level: Debug
info: Configuration:  Root Path: /
info: Configuration:  Connection to NBXplorer's database successful, dashboard and reporting features activated.
info: Configuration:  SSH settings detected, testing connection to root@host.docker.internal on port 22 ...
info: Configuration:  SSH connection succeeded
info: PayServer:      Starting listening NBXplorer (BTC)
info: PayServer:      Start watching invoices
info: PayServer:      Starting payment request expiration watcher
info: PayServer:      1 pending payment requests being checked since last run
info: BTCPayServer.Plugins.LNbank.Services.LightningInvoiceWatcher: Starting
info: Configuration:  Now listening on: http://0.0.0.0:49392
info: PayServer:      BTC: Checking if any pending invoice got paid while offline...
info: PayServer:      BTC: 0 payments happened while offline
info: PayServer:      Connected to WebSocket of NBXplorer (BTC)
fail: Microsoft.AspNetCore.Server.Kestrel: Connection id "0HMM5JREBT4V1", Request id "0HMM5JREBT4V1:00000002": An unhandled exception was thrown by the application.
System.NullReferenceException: Object reference not set to an instance of an object.
   at BTCPayServer.Payments.Bitcoin.BitcoinLikePaymentHandler.PreparePaymentModel(PaymentModel model, InvoiceResponse invoiceResponse, StoreBlob storeBlob, IPaymentMethod paymentMethod) in /source/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs:line 95
   at BTCPayServer.Controllers.UIInvoiceController.GetInvoiceModel(String invoiceId, PaymentMethodId paymentMethodId, String lang) in /source/BTCPayServer/Controllers/UIInvoiceController.UI.cs:line 816
   at BTCPayServer.Controllers.UIInvoiceController.GetStatus(String invoiceId, String paymentMethodId, String implicitPaymentMethodId, String lang) in /source/BTCPayServer/Controllers/UIInvoiceController.UI.cs:line 845
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at BTCPayServer.Hosting.BTCPayMiddleware.Invoke(HttpContext httpContext) in /source/BTCPayServer/Hosting/BTCpayMiddleware.cs:line 101
   at BTCPayServer.Hosting.GreenfieldMiddleware.Invoke(HttpContext httpContext) in /source/BTCPayServer/Hosting/GreenfieldMiddleware.cs:line 50
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at BTCPayServer.Hosting.HeadersOverrideMiddleware.Invoke(HttpContext httpContext) in /source/BTCPayServer/Hosting/HeadersOverrideMiddleware.cs:line 30
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
fail: Microsoft.AspNetCore.Server.Kestrel: Connection id "0HMM5JREBT4VI", Request id "0HMM5JREBT4VI:00000002": An unhandled exception was thrown by the application.
System.NullReferenceException: Object reference not set to an instance of an object.
   at BTCPayServer.Payments.Bitcoin.BitcoinLikePaymentHandler.PreparePaymentModel(PaymentModel model, InvoiceResponse invoiceResponse, StoreBlob storeBlob, IPaymentMethod paymentMethod) in /source/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs:line 95
   at BTCPayServer.Controllers.UIInvoiceController.GetInvoiceModel(String invoiceId, PaymentMethodId paymentMethodId, String lang) in /source/BTCPayServer/Controllers/UIInvoiceController.UI.cs:line 816
   at BTCPayServer.Controllers.UIInvoiceController.GetStatus(String invoiceId, String paymentMethodId, String implicitPaymentMethodId, String lang) in /source/BTCPayServer/Controllers/UIInvoiceController.UI.cs:line 845
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at BTCPayServer.Hosting.BTCPayMiddleware.Invoke(HttpContext httpContext) in /source/BTCPayServer/Hosting/BTCpayMiddleware.cs:line 101
   at BTCPayServer.Hosting.GreenfieldMiddleware.Invoke(HttpContext httpContext) in /source/BTCPayServer/Hosting/GreenfieldMiddleware.cs:line 50
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at BTCPayServer.Hosting.HeadersOverrideMiddleware.Invoke(HttpContext httpContext) in /source/BTCPayServer/Hosting/HeadersOverrideMiddleware.cs:line 30
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
fail: Microsoft.AspNetCore.Server.Kestrel: Connection id "0HMM5JREBT4VU", Request id "0HMM5JREBT4VU:00000002": An unhandled exception was thrown by the application.
System.NullReferenceException: Object reference not set to an instance of an object.
   at BTCPayServer.Payments.Bitcoin.BitcoinLikePaymentHandler.PreparePaymentModel(PaymentModel model, InvoiceResponse invoiceResponse, StoreBlob storeBlob, IPaymentMethod paymentMethod) in /source/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs:line 95
   at BTCPayServer.Controllers.UIInvoiceController.GetInvoiceModel(String invoiceId, PaymentMethodId paymentMethodId, String lang) in /source/BTCPayServer/Controllers/UIInvoiceController.UI.cs:line 816
   at BTCPayServer.Controllers.UIInvoiceController.GetStatus(String invoiceId, String paymentMethodId, String implicitPaymentMethodId, String lang) in /source/BTCPayServer/Controllers/UIInvoiceController.UI.cs:line 845
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at BTCPayServer.Hosting.BTCPayMiddleware.Invoke(HttpContext httpContext) in /source/BTCPayServer/Hosting/BTCpayMiddleware.cs:line 101
   at BTCPayServer.Hosting.GreenfieldMiddleware.Invoke(HttpContext httpContext) in /source/BTCPayServer/Hosting/GreenfieldMiddleware.cs:line 50
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at BTCPayServer.Hosting.HeadersOverrideMiddleware.Invoke(HttpContext httpContext) in /source/BTCPayServer/Hosting/HeadersOverrideMiddleware.cs:line 30
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
warn: PayServer:      Error while contacting exchange coingecko: An error occurred while sending the request.
warn: PayServer:      Error while contacting exchange coingecko: An error occurred while sending the request.
warn: PayServer:      Error while contacting exchange coingecko: An error occurred while sending the request.
warn: PayServer:      Error while contacting exchange coingecko: The operation was canceled.
warn: PayServer:      Error while contacting exchange coingecko: An error occurred while sending the request.
warn: PayServer:      Error while contacting exchange coingecko: An error occurred while sending the request.
fail: PayServer:      Error while connecting to WebSocket of NBXplorer (BTC)
System.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake.
   at System.Net.WebSockets.ManagedWebSocket.ThrowIfEOFUnexpected(Boolean throwOnPrematureClosure)
   at System.Net.WebSockets.ManagedWebSocket.EnsureBufferContainsAsync(Int32 minimumRequiredBytes, CancellationToken cancellationToken, Boolean throwOnPrematureClosure)
   at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate[TResult](Memory`1 payloadBuffer, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
   at System.Threading.Tasks.ValueTask`1.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state)
--- End of stack trace from previous location ---
   at NBXplorer.WebsocketMessageListener.NextMessageAsync(CancellationToken cancellation)
   at BTCPayServer.Payments.Bitcoin.NBXplorerListener.Listen(BTCPayWallet wallet) in /source/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs:line 142
info: PayServer:      Disconnected from WebSocket of NBXplorer (BTC)
fail: PayServer:      Error while connecting to WebSocket of NBXplorer (BTC)
System.Net.WebSockets.WebSocketException (0x80004005): Unable to connect to the remote server
 ---> System.Net.Http.HttpRequestException: Connection refused (nbxplorer:32838)
 ---> System.Net.Sockets.SocketException (111): Connection refused
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|277_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)
   at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.WebSockets.WebSocketHandle.ConnectAsync(Uri uri, CancellationToken cancellationToken, ClientWebSocketOptions options)
   at System.Net.WebSockets.WebSocketHandle.ConnectAsync(Uri uri, CancellationToken cancellationToken, ClientWebSocketOptions options)
   at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore(Uri uri, CancellationToken cancellationToken)
   at NBXplorer.WebsocketNotificationSession.ConnectAsyncCore(String uri, CancellationToken cancellation)
   at NBXplorer.WebsocketNotificationSession.ConnectAsync(CancellationToken cancellation)
   at NBXplorer.ExplorerClient.CreateWebsocketNotificationSessionAsync(CancellationToken cancellation)
   at BTCPayServer.Payments.Bitcoin.NBXplorerListener.Listen(BTCPayWallet wallet) in /source/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs:line 122
fail: PayServer:      BTC: NBXplorer error `Connection refused (nbxplorer:32838)`
fail: PayServer:      BTC: NBXplorer error `Connection refused (nbxplorer:32838)`
info: PayServer:      BTC: Checking if any pending invoice got paid while offline...
info: PayServer:      BTC: 0 payments happened while offline
info: PayServer:      Connected to WebSocket of NBXplorer (BTC)
NicolasDorier commented 1 year ago

With @petzsch we noticed that two payment methods failed (because full node unavailable), but those were still added to the invoice with null value.

@petzsch supposes it is because of lazy payments. I think he is right, as CreateInvoiceCore shouldn't do this.

{
"cryptoData": {
    "BTC_LightningLike": {
      "rate": 100000000.0,
      "paymentMethod": {
        "BOLT11": null,
        "PaymentHash": null,
        "InvoiceId": null,
        "NodeInfo": null,
        "Activated": false
      },
      "feeRate": null,
      "txFee": null,
      "depositAddress": null
    },
    "BTC": {
      "rate": 100000000.0,
      "paymentMethod": {
        "activated": false,
        "networkFeeMode": 0,
        "networkFeeRate": null,
        "payjoinEnabled": false,
        "keyPath": null
      },
      "feeRate": null,
      "txFee": null,
      "depositAddress": null
    }
  }
}

Ping @Kukks

NicolasDorier commented 1 year ago

This is a bug from BTCpay Server actually.

NicolasDorier commented 1 year ago

Transfered to https://github.com/btcpayserver/btcpayserver/issues/4289

NicolasDorier commented 1 year ago

Note this issue had another bug related to NBX: NBX is asking for the full mempool upon connecting to a node. But the mempool is so big that it would stall the sync completely.

I removed this on https://github.com/dgarage/NBXplorer/commit/f063979667e533042c84748143dc316dbee46774