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.
This commit is contained in:
Slyghtning committed 2026-02-05 08:58:31 +01:00
1 parent 3c22c3e7fa
commit d39577682e
1 file changed
+14 -7
+14 -7
View File
@@ -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