Skip to content

Update speedloader for lnd 0.20#8

Open
hsjoberg wants to merge 1 commit intodjkazic:masterfrom
hsjoberg:lnd020
Open

Update speedloader for lnd 0.20#8
hsjoberg wants to merge 1 commit intodjkazic:masterfrom
hsjoberg:lnd020

Conversation

@hsjoberg
Copy link
Contributor

@hsjoberg hsjoberg commented Dec 5, 2025

More graph and db refactoring happened between lnd 0.19 and 0.20 which caused speedloader to break

@gemini-code-assist
Copy link

Summary of Changes

Hello @hsjoberg, 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 updates the speedloader component to maintain compatibility with the latest lnd version 0.20. It addresses significant refactoring in lnd's graph and database layers, ensuring that speedloader can correctly interact with the updated data structures and API calls. The changes primarily involve adapting to new model types, revised database initialization patterns, and the introduction of context parameters in database operations.

Highlights

  • Graph Database Initialization: The initialization of the ChannelGraph has been updated to first create a graphdb.KVStore from the backend, and then use this store to instantiate the ChannelGraph.
  • Model Type Update: The models.LightningNode type has been replaced with models.Node across several function signatures and variable declarations, reflecting a change in the underlying data model.
  • Context Propagation: A globalCtx (context) parameter has been added to numerous graph database methods, including SourceNode, ForEachNodeChannel, SetSourceNode, AddNode, AddChannelEdge, and UpdateEdgePolicy, to support context-aware operations.
  • ForEachNodeChannel Signature Change: The ForEachNodeChannel function now accepts an additional empty function argument, indicating a change in its callback mechanism or optional processing.
  • Node Addition Method Renamed: The method graphKV.AddLightningNode has been renamed to graphKV.AddNode, aligning with the updated model type.
  • New Import: The github.com/lightningnetwork/lnd/routing/route package has been imported, likely to support new routing-related types or functionalities, such as route.Vertex.
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.

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 updates the speedloader to be compatible with lnd 0.20. The changes primarily involve adapting to API modifications in lnd's graph and database packages. This includes using graphdb.NewKVStore, updating function signatures to pass a context, and using the models.Node type instead of the deprecated models.LightningNode. The changes are mostly correct and implement the necessary updates. I've added one comment regarding code duplication in error handling to improve maintainability.

Comment on lines +118 to +119
chanDB.Close()
backend.Close()

Choose a reason for hiding this comment

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

medium

This error handling block duplicates the cleanup logic found on lines 126-127. To improve maintainability and avoid repetition, consider extracting the cleanup logic (chanDB.Close() and backend.Close()) into a local helper function or using a defer statement with a named error return to handle cleanup.

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.

1 participant