chainrpc: return Unavailable while notifier starts#10352
Merged
yyforyongyu merged 2 commits intolightningnetwork:masterfrom Nov 13, 2025
Merged
chainrpc: return Unavailable while notifier starts#10352yyforyongyu merged 2 commits intolightningnetwork:masterfrom
yyforyongyu merged 2 commits intolightningnetwork:masterfrom
Conversation
From v0.20.0-rc3 (commit c6f458e) onward the ChainNotifier sub-server may still be initialising when clients attempt to subscribe, currently resulting in a gRPC Unknown error with a plain-text message. Change the notifier RPC endpoints to return codes.Unavailable instead so clients can reliably interpret the condition as "retry later" and handle the startup lag without unstable string matching.
d6c3e8f to
c165bae
Compare
starius
added a commit
to starius/lndclient
that referenced
this pull request
Nov 7, 2025
lnd v0.20.0-rc3 delays ChainNotifier startup which causes Loop to hit "chain notifier RPC is still in the process of starting" during initial subscriptions (LND commit c6f458e478f9ef2cf1d394972bfbc512862c6707). Add a shared retry helper in lndclient so block epoch, confirmation and spend registrations transparently retry until the sub-server is ready, along with regression tests covering the behaviour. With lnd PR lightningnetwork/lnd#10352 the server now returns gRPC codes.Unavailable instead of codes.Unknown, so the helper accepts either signal (status code or a string).
3 tasks
starius
added a commit
to starius/lndclient
that referenced
this pull request
Nov 7, 2025
lnd v0.20.0-rc3 delays ChainNotifier startup which causes Loop to hit "chain notifier RPC is still in the process of starting" during initial subscriptions (LND commit c6f458e478f9ef2cf1d394972bfbc512862c6707). Add a shared retry helper in lndclient so block epoch, confirmation and spend registrations transparently retry until the sub-server is ready, along with regression tests covering the behavior. With lnd PR lightningnetwork/lnd#10352 the server now returns gRPC codes.Unavailable instead of codes.Unknown, so the helper accepts either signal (status code or a string).
starius
added a commit
to starius/lndclient
that referenced
this pull request
Nov 7, 2025
lnd v0.20.0-rc3 delays ChainNotifier startup which causes Loop to hit "chain notifier RPC is still in the process of starting" during initial subscriptions (LND commit c6f458e478f9ef2cf1d394972bfbc512862c6707). Add a shared retry helper in lndclient so block epoch, confirmation and spend registrations transparently retry until the sub-server is ready, along with regression tests covering the behavior. With lnd PR lightningnetwork/lnd#10352 the server now returns gRPC codes.Unavailable instead of codes.Unknown, so the helper accepts either signal (status code or a string).
Also fixed a typo in release notes.
c165bae to
e4313eb
Compare
Contributor
|
Let's add motive behind that PR in the PR description. That can help give reviewers some context and perhaps getting some attraction. In other words referencing this: lightninglabs/lndclient#253 (comment) |
Collaborator
Author
Great idea! I added Motivation section. |
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Description
From v0.20.0-rc3 (commit c6f458e) onward the ChainNotifier sub-server may still be initialising when clients attempt to subscribe, currently resulting in a gRPC Unknown error with a plain-text message. Change the notifier RPC endpoints to return codes.Unavailable instead so clients can reliably interpret the condition as "retry later" and handle the startup lag without unstable string matching.
Motivation
To ensure that Loop and other services wait for LND while it is starting up, lndclient was modified to retry when it encounters the "chain notifier RPC is still in the process of starting" error. @mohamedawnallah noted in the review that relying on matching error strings is not ideal. Using an error code on the other hand is more reliable. The purpose of this PR is to provide lndclient (and other clients) with a clear signal to retry the request. See lightninglabs/lndclient#253 (comment)
Steps to Test
Send
RegisterBlockEpochNtfnwhile LND is starting and inspect the returned gRPC error code. It should beUnavailable.Pull Request Checklist
Testing
Code Style and Documentation
[skip ci]in the commit message for small changes.📝 Please see our Contribution Guidelines for further guidance.