From d39577682ef5871b345a59af92851c5901665eb7 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Fri, 16 Jan 2026 16:03:59 +0100 Subject: [PATCH] rpcserver: populate wallet_synced in GetInfo response In this commit, we extend the chainSyncInfo struct with a new isWalletSynced field that tracks the wallet's sync state independently from the composite isSynced field. The GetInfo RPC handler now populates the WalletSynced response field from this new struct field. A debug log line is added to GetInfo to help diagnose sync state issues, showing both the composite sync status and the wallet-specific sync status. Currently isWalletSynced mirrors isSynced since both ultimately derive from the same underlying wallet sync check. This prepares the plumbing for future differentiation where wallet sync state could be tracked separately from router and blockbeat dispatcher states. --- rpcserver.go | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/rpcserver.go b/rpcserver.go index e5d59a317..fe0e6702b 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -3450,6 +3450,7 @@ func (r *rpcServer) GetInfo(_ context.Context, Features: features, RequireHtlcInterceptor: r.cfg.RequireInterceptor, StoreFinalHtlcResolutions: r.cfg.StoreFinalHtlcResolutions, + WalletSynced: syncInfo.isWalletSynced, }, nil } @@ -9468,6 +9469,10 @@ type chainSyncInfo struct { // - blockbeat dispatcher. isSynced bool + // isWalletSynced specifies whether the wallet is synced to + // our chain view. + isWalletSynced bool + // bestHeight is the current height known to the chain backend. bestHeight int32 @@ -9488,22 +9493,23 @@ func (r *rpcServer) getChainSyncInfo() (*chainSyncInfo, error) { return nil, fmt.Errorf("unable to get best block info: %w", err) } - isSynced, bestHeaderTimestamp, err := r.server.cc.Wallet.IsSynced() + isWalletSynced, bestHeaderTimestamp, err := + r.server.cc.Wallet.IsSynced() if err != nil { return nil, fmt.Errorf("unable to sync PoV of the wallet "+ "with current best block in the main chain: %v", err) } - // Create an info to be returned. + // Create info to be returned. info := &chainSyncInfo{ - isSynced: isSynced, - bestHeight: bestHeight, - blockHash: *bestHash, - timestamp: bestHeaderTimestamp, + isWalletSynced: isWalletSynced, + bestHeight: bestHeight, + blockHash: *bestHash, + timestamp: bestHeaderTimestamp, } // Exit early if the wallet is not synced. - if !isSynced { + if !isWalletSynced { rpcsLog.Debugf("Wallet is not synced to height %v yet", bestHeight) @@ -9518,6 +9524,7 @@ func (r *rpcServer) getChainSyncInfo() (*chainSyncInfo, error) { // by many wallets (and also our itests) to make sure everything's up to // date, we add the router's state to it. So the flag will only toggle // to true once the router was also able to catch up. + isSynced := isWalletSynced if !r.cfg.Routing.AssumeChannelValid { routerHeight := r.server.graphBuilder.SyncedHeight() isSynced = uint32(bestHeight) == routerHeight