staticaddr: channel funding with deposits#1040
staticaddr: channel funding with deposits#1040hieblmi wants to merge 9 commits intolightninglabs:masterfrom
Conversation
Summary of ChangesHello @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 significantly extends the functionality of static addresses by enabling them to be used as a source for funding Lightning channels. It introduces a new 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.
Code Review
This pull request introduces a new openchannel subcommand for static addresses, allowing users to fund channels from their deposits. The implementation is comprehensive, covering the command-line interface, RPC definitions, daemon logic, and documentation.
My review focuses on the new cmd/loop/openchannel.go file, where I've identified a few issues related to context handling, input validation, and error wrapping. These are important for ensuring the robustness and maintainability of the new command.
The refactoring to move utility functions into a staticutil package is a great improvement for code organization and reuse. The protocol changes to use PSBT for withdrawals are also a solid enhancement.
Overall, this is a well-structured PR that adds significant functionality. Addressing the feedback will further improve its quality.
f9b49dc to
9d37fca
Compare
94f45cc to
375cf47
Compare
2b9378a to
5b6631d
Compare
|
@gemini-code-assist review |
e18703f to
68474b0
Compare
68474b0 to
0e07e19
Compare
sputn1ck
left a comment
There was a problem hiding this comment.
Review notes (short):
- Any error after PSBT finalize currently transitions deposits back to Deposited. If finalize already handed tx to lnd (NoPublish=false), we can end up reusing spent deposits. Can we gate rollback once finalize is sent or persist txid/reconcile?
- On recover, OpeningChannel just self-loops with no action. If we restart mid-flow, deposits can remain locked forever. Should we reconcile against lnd pending channels or on-chain spends?
- We estimate fee twice when sat_per_vbyte is unset (calc vs PSBT build). Funding amount can be computed with one rate and PSBT built with another. Can we thread a single fee rate through?
- MinConfs is effectively ignored (hard-coded to 1), but checkPsbtFlags only checks !=1/SpendUnconfirmed. Should we validate and reject unsupported MinConfs explicitly before locking deposits?
- SelectDeposits doesn’t account for fees. We lock deposits based only on local_amt + dust, then may fail when fee is applied. Worth a fee-aware selection or pre-check before OnOpeningChannel.
3d2e8cf to
2b998d1
Compare
d2d2a88 to
ffa9e9e
Compare
Make our own type StaticAddressLoopInRequest which has a single field of type lnrpc.OpenChannelRequest. Removed copy-pasted lnrpc types which are needed for OpenChannelRequest.
Block-based deposit fetching from the internal lnd wallet was susceptible to wallet syncing issues. Replace it with interval-based polling. Reconciliation errors are now logged instead of being fatal, improving resilience during transient failures.
ffa9e9e to
75a263b
Compare
|
Hi @sputn1ck, I addressed some more findings, namely:
|
This PR introduces a
openchannelsubcommand to static addresses.It provides the same experience as
lncli openchannel.Exmples:
Open a channel with all available deposits:
Open a channel with specified local funding amount, coin-selected from available deposits under fee and dust considerations.
Open a channel from two deposits AAA and BBB while taking their combined value(fundmax) as funding amount and considering fees and dust limit.
Open a channel from two deposits AAA and BBB while taking a specified amount(local_amt) as funding amount and considering fees and dust limit.
TODOs: