Skip to content

Conversation

@hieblmi
Copy link
Collaborator

@hieblmi hieblmi commented Jan 16, 2026

Change Description

This PR adds a new field wallet_synced to the GetInfoResponse to inform the caller if the wallet is still syncing to the best chain tip.

Steps to Test

See the attached itest.

@gemini-code-assist
Copy link

Summary of Changes

Hello @hieblmi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the ListUnspent RPC by introducing a wallet_is_synced boolean field to its response. This addition provides crucial transparency to API consumers, allowing them to determine if the wallet's view of unspent transaction outputs is fully up-to-date with the blockchain's current state. By explicitly indicating when the wallet is still synchronizing, applications can avoid misinterpreting potentially incomplete UTXO data, thereby improving the reliability and robustness of wallet interactions.

Highlights

  • New wallet_is_synced field: The ListUnspentResponse RPC now includes a new boolean field, wallet_is_synced, in both the main Lightning service and WalletKit.
  • Improved Wallet State Visibility: This field informs callers whether the wallet has fully synchronized with the current chain tip, addressing potential race conditions where UTXO lists might be incomplete if the wallet is still catching up.
  • Comprehensive Testing: An integration test (itest/lnd_wallet.go) has been added to thoroughly verify the correct behavior of the wallet_is_synced field, especially during wallet catch-up scenarios.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@hieblmi hieblmi changed the title Wallet tip walletrpc: add walled_is_synced to ListUnspentResponse Jan 16, 2026
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a wallet_is_synced field to the ListUnspent RPC response, which is a useful addition for clients to know if the wallet's view of UTXOs is up-to-date. The implementation is clean and duplicated correctly across both the main rpcserver and the walletrpc sub-server. The new integration test covers the intended functionality well by simulating a node restart and sync process. The changes to protobuf and swagger definitions are also correct. I have one minor suggestion for the release notes.

@hieblmi hieblmi changed the title walletrpc: add walled_is_synced to ListUnspentResponse rpcserver: add WalletSynced to GetInfo Jan 16, 2026
@hieblmi hieblmi changed the title rpcserver: add WalletSynced to GetInfo rpcserver: add wallet_synced to GetInfoResponse Jan 16, 2026
In this commit, we add a new `wallet_synced` boolean field to the
GetInfoResponse message. This field exposes the wallet's internal sync
state with the backing chain source, providing visibility into whether
the wallet has caught up to the current chain tip.

This is distinct from the existing `synced_to_chain` field, which
represents a composite sync state that also considers the router and
blockbeat dispatcher. The new field allows callers to distinguish
between wallet sync delays and other subsystem sync states.
Generated files for the wallet_synced field addition to GetInfoResponse.
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.
In this commit, we add an integration test that verifies the
wallet_synced field in GetInfoResponse correctly reflects the wallet's
sync state.

The test creates a node, verifies wallet_synced becomes true after
initial sync, then stops the node and mines blocks while it's offline.
After restart, the test polls GetInfo to observe the wallet catching up,
ideally capturing the transition from wallet_synced=false to true.

The test is registered in the "wallet sync" test case group.

// Whether the wallet is fully synced to the best chain. This indicates the
// wallet's internal sync state with the backing chain source.
bool wallet_synced = 23;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we expose the block at which the wallet is?

uint32 wallet_block_height = 24;
string wallet_block_hash = 25;

Then we can track this field to reach the block we're handling deposits for:

blockSub := RegisterBlockEpochNtfn()
block := <-blockSub

info := GetInfo()
for info.WalletBlockHeight < block.Height {
  sleep
  info = GetInfo()
}

ListUnspent()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants