Repository navigation
Conversation
BlockUntilUnlocked returns as soon as lnd reports the RPC_ACTIVE wallet state. At that point lnd's main server is still starting up, so RPC calls made right after NewLndServices returns can still fail. Add a BlockUntilServerActive config option that makes NewLndServices wait for the SERVER_ACTIVE state instead. Setting it implies waiting for the unlock. The behavior of BlockUntilUnlocked is unchanged.
agammann
reviewed
Nov 11, 2026
agammann
left a comment
There was a problem hiding this comment.
BlockUntilServerActive promises to return only after WalletStateServerActive, and the comment says older lnd versions will wait until CallerCtx is canceled. But both closed-channel branches in getLndInfo still call getInfo() unconditionally. A v0.13 stream that closes after RPC_ACTIVE can therefore return successfully before SERVER_ACTIVE ever appears. Could those branches honor waitForServerActive (or return a version/stream-ended error) and add a regression where the state channel closes without the new state?
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.
Problem
BlockUntilUnlockedmakesNewLndServicesreturn as soon as lnd reports theRPC_ACTIVEwallet state. At that point lnd's main server is still starting, so RPC calls made right after startup can still fail.Change
Add a
BlockUntilServerActiveoption toLndServicesConfig. When set,NewLndServicesblocks until lnd reportsSERVER_ACTIVE.BlockUntilUnlockeddoes not need to be set as well.BlockUntilUnlockedbehaves exactly as before.CallerCtx, like the other startup waits.Usage
Testing
TestGetLndInfohas two new cases:SERVER_ACTIVEand the call returns;RPC_ACTIVEand the call keeps waiting until the context expires, rather than returning early.The test mock now closes its channels on
SERVER_ACTIVE, matching the real state client.Checklist
SERVER_ACTIVE.macaroon_recipes.gois unchanged.