From b0aa4ae2de488a66ab507b85fdeb93843d107b6c Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Wed, 18 Jun 2025 17:10:47 +0800 Subject: [PATCH] chainio: use package logger instead of instance logger There's no guarantee that the `b.beat` is initialized when the dispatcher shuts down, especially with the case in the remote signer where no chainbackend is created. --- chainio/dispatcher.go | 8 ++++++++ docs/release-notes/release-notes-0.19.2.md | 3 +++ 2 files changed, 11 insertions(+) diff --git a/chainio/dispatcher.go b/chainio/dispatcher.go index f1fce35b5..0d56752b8 100644 --- a/chainio/dispatcher.go +++ b/chainio/dispatcher.go @@ -135,6 +135,14 @@ func (b *BlockbeatDispatcher) Stop() { } func (b *BlockbeatDispatcher) log() btclog.Logger { + // There's no guarantee that the `b.beat` is initialized when the + // dispatcher shuts down, especially in the case where the node is + // running as a remote signer, which doesn't have a chainbackend. In + // that case we will use the package logger. + if b.beat == nil { + return clog + } + return b.beat.logger() } diff --git a/docs/release-notes/release-notes-0.19.2.md b/docs/release-notes/release-notes-0.19.2.md index 40f05624a..4cf16724c 100644 --- a/docs/release-notes/release-notes-0.19.2.md +++ b/docs/release-notes/release-notes-0.19.2.md @@ -26,6 +26,9 @@ - [Fixed](https://github.com/lightningnetwork/lnd/pull/9921) a case where the spending notification of an output may be missed if wrong height hint is used. +- [Fixed](https://github.com/lightningnetwork/lnd/pull/9962) a case where the + node may panic if it's running in the remote signer mode. + # New Features ## Functional Enhancements