Refactor Payment PR 5 (discarded because merged into wrong branch)#10151
Conversation
Let the helper method only take the params it needs so that we dont need to construct an entire models.ChannelEdgeInfo object to pass to it. This will be useful later on.
Since the type returned from the DB is not a pointer. This will be useful later on.
The following performance gains were measured using the new benchmark test. ``` name old time/op new time/op delta ChanUpdatesInHorizon-native-sqlite-10 18.5s ± 3% 2.0s ± 5% -89.11% (p=0.000 n=9+9) ChanUpdatesInHorizon-native-postgres-10 59.0s ± 3% 0.8s ±10% -98.65% (p=0.000 n=10+9) ```
…ng-version update Golang version to v1.23.12 to fix potential SQL bug
We check the context of the payment lifecycle at the beginning of the `resumepayment` loop. This will make sure we have always the latest state of the payment before deciding on the next steps in the function `decideNextStep`.
[8] graph/db: use batch loading for various graph SQL methods
We add a new update type to the payment descriptor to describe this new type of htlc. This type of HTLC will only end up being set if explicitly signalled by external software.
We also add the IsAdd helper to the AuxHtlcDescriptor, as external software using the aux framework might want to know which type of HTLC this is.
We update the lightning channel state machine in some key areas. If the noop TLV is set in the update_add_htlc custom records then we change the entry type to noop. When settling the HTLC if the type is noop we credit the satoshi amount back to the sender.
Adds some simple tests to check the noop HTLC logic of the lightning channel.
To make sure we don't cause force-closures because of commit sig mismatches, we add a test case to verify that the retransmitted HTLC matches the original HTLC.
This error is returned when one attempts to use taproot overlay channels without the necessary auxiliary funding controller being supplied. In practice, when running lnd via litd, the latter will always supply 'tapd' as the aux funding controller, but a standalone lnd has no knowledge of that. The previous message sort of reads like the lnd user has forgotten to set some available option or flag, but nothing or the sort actually exists. The update makes it clearer that the feature isn't available in the standalone build.
server: don't mention aux controllers in error message
…-key scripts: update hieblmi pgp key
…ayment fix stuck payment
There was a problem hiding this comment.
Summary of Changes
Hello @ziggie1984, 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 undertakes a significant refactoring of the payment management system by introducing a dedicated paymentsdb package. The primary goal is to modularize payment-related database operations and data structures, moving them out of the more general channeldb package. This change enhances code organization, improves maintainability, and lays the groundwork for potential future database backend implementations. The refactoring involves creating new interfaces, migrating existing code, and updating all dependent modules to interact with the new payment database abstraction.
Highlights
- New Payments Database Package: Introduced a new top-level Go package named
paymentsdbto encapsulate all payment-related database logic and data structures, promoting better modularity and separation of concerns. - Code Migration and Reorganization: Migrated core payment entities such as
FailureReason,PaymentCreationInfo,MPPayment, andHTLCAttemptfrom thechanneldbpackage to the newpaymentsdbpackage, along with their associated serialization/deserialization logic. - Database Interface Abstraction: Defined a
PaymentDBinterface withinpaymentsdbto standardize interactions with the payment database, allowing for future flexibility (e.g., supporting SQL backends) without impacting existing logic. - Channeldb Decoupling: Updated
channeldbto remove its direct payment management responsibilities, including migrations and data structures, now delegating these to thepaymentsdbpackage. - System-Wide Integration: Adjusted various components across the codebase, including
config_builder,lnrpcservices,routinglogic, andrpcserver, to reflect the newpaymentsdbpackage structure and its defined interfaces and types.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| 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 issue 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
-
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. ↩
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
ad1b241 to
d106ffd
Compare
Add `NoopAdd` HTLCs
d106ffd to
461dfb1
Compare
…ments-code-03 Refactor Payment PR 3
We export some methods related to the pagination logic be the kv store implemenation of the payment data will live in another package.
This method is not only used by the payment logic so we need to move it to a generalized place because in the following commits we move payment related code into its own package.
This commit moves most of the code into its own package. It is the smallest code move possible without moving import cycles and keeping the changes to the code base as small as possible during refactor.
We also rename the struct since it is now in its own package there is no need to prefix it.
This commit starts reusing test cases which are not dependant on the kv db backend. So they can be later used with the native db implementation as well.
we make the index assertion db independant so it is a noop for a future native sql backend. This allows us to reuse even more tests for the different db architectures.
461dfb1 to
3e885a4
Compare
3e885a4
into
lightningnetwork:elle-payment-sql-series
Depends on #9847 (only new commits beginning at the 5 commit)