-
-
Notifications
You must be signed in to change notification settings - Fork 218
feat(Channel backup): Allow users to move to other device while keep the channels intact #3606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @shubhamkmr04, 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 introduces significant enhancements to the embedded LND node management within the application. The core focus is on enabling seamless channel migration between devices, providing users with greater flexibility and control over their Lightning Network funds. Additionally, it expands the application's compatibility by integrating Esplora as an alternative blockchain backend and extending support to the Testnet4 network, offering more choices for how users connect to the Bitcoin blockchain. These changes are accompanied by an LND version upgrade and various UI adjustments to support the new functionalities. Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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 significant new features, including support for Testnet4, the ability to switch between Neutrino and Esplora blockchain backends, and a channel migration tool. The refactoring of network and backend configuration is well-structured, and the channel migration feature incorporates appropriate safety measures like a locked wallet state and app restarts. Overall, the changes enhance the wallet's flexibility and user experience.
views/Tools/index.tsx
Outdated
| getChannelDbPath = async ( | ||
| lndDir: string, | ||
| isTestnet: boolean, | ||
| isSqlite: boolean | ||
| ) => { | ||
| const network = isTestnet ? 'testnet' : 'mainnet'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The getChannelDbPath function currently determines the network folder based on a generic isTestnet boolean. However, the underlying LND configuration (as seen in utils/LndMobileUtils.ts) differentiates between testnet (Testnet3) and testnet4 for folder structures. Using isTestnet ? 'testnet' : 'mainnet' will incorrectly map Testnet4 to the testnet folder, potentially leading to issues with locating or restoring channel backups for Testnet4 nodes. It's crucial to use the specific network string from SettingsStore.embeddedLndNetwork to ensure the correct path is constructed.
| getChannelDbPath = async ( | |
| lndDir: string, | |
| isTestnet: boolean, | |
| isSqlite: boolean | |
| ) => { | |
| const network = isTestnet ? 'testnet' : 'mainnet'; | |
| getChannelDbPath = async ( | |
| lndDir: string, | |
| network: string, | |
| isSqlite: boolean | |
| ) => { | |
| const networkPath = network.toLowerCase(); |
views/Tools/index.tsx
Outdated
| const dbPath = await this.getChannelDbPath( | ||
| getLndDir(), | ||
| isTestnet, | ||
| isSqlite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The call to getChannelDbPath needs to be updated to pass the actual network string (SettingsStore.embeddedLndNetwork) instead of a boolean isTestnet. This aligns with the updated signature and logic of getChannelDbPath to correctly identify the network folder for channel backups.
| const dbPath = await this.getChannelDbPath( | |
| getLndDir(), | |
| isTestnet, | |
| isSqlite | |
| const dbPath = await this.getChannelDbPath( | |
| getLndDir(), | |
| this.props.SettingsStore.embeddedLndNetwork || 'mainnet', | |
| isSqlite | |
| ); |
views/Tools/index.tsx
Outdated
| const lndDir = this.props.SettingsStore.lndDir || 'lnd'; | ||
| const isTestnet = this.props.NodeInfoStore!.nodeInfo.isTestNet; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The isTestnet variable here is derived from NodeInfoStore!.nodeInfo.isTestNet, which is true for both Testnet3 and Testnet4. However, the destination folder is determined using isTestnet ? 'testnet' : 'mainnet'. This will incorrectly place Testnet4 backups into the testnet folder, leading to a mismatch with the actual LND directory structure (which uses testnet4 for Testnet4). This could prevent successful restoration of channel backups for Testnet4 nodes.
| const lndDir = this.props.SettingsStore.lndDir || 'lnd'; | |
| const isTestnet = this.props.NodeInfoStore!.nodeInfo.isTestNet; | |
| const networkPath = this.props.SettingsStore.embeddedLndNetwork?.toLowerCase() || 'mainnet'; | |
| const destFolder = `${rootPath}/${lndDir}/data/graph/${networkPath}`; |
views/Tools/index.tsx
Outdated
| const backupFileName = `zeus-channels-${ | ||
| isTestnet ? 'testnet' : 'mainnet' | ||
| }-${Date.now()}.${extension}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The backup file name should accurately reflect the specific network (e.g., 'testnet3' or 'testnet4') rather than a generic 'testnet' if isTestnet is true. This ensures clarity and avoids potential confusion or overwrites if different testnets have distinct backup files.
| const backupFileName = `zeus-channels-${ | |
| isTestnet ? 'testnet' : 'mainnet' | |
| }-${Date.now()}.${extension}`; | |
| const backupFileName = `zeus-channels-${ | |
| this.props.SettingsStore.embeddedLndNetwork?.toLowerCase() || 'mainnet' | |
| }-${Date.now()}.${extension}`; |
2f3672d to
d3221aa
Compare
…rate channel migration utility file
ef3f36a to
6b0e365
Compare
Description
This pull request is categorized as a:
Checklist
yarn run tscand made sure my code compiles correctlyyarn run lintand made sure my code didn’t contain any problematic patternsyarn run prettierand made sure my code is formatted correctlyyarn run testand made sure all of the tests passTesting
If you modified or added a utility file, did you add new unit tests?
I have tested this PR on the following platforms (please specify OS version and phone model/VM):
I have tested this PR with the following types of nodes (please specify node version and API version where appropriate):
Locales
Third Party Dependencies and Packages
yarnafter this PR is merged inpackage.jsonandyarn.lockhave been properly updatedOther: