db: implement sql tables and store for channel events#236
Conversation
Summary of ChangesHello, 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 a new database layer to track channel-related events, such as balance updates and connectivity status. It sets up the necessary SQL schema, migrations, and Go data access objects to store and retrieve this information, while also enhancing the project's testing infrastructure to support both SQLite and Postgres. Highlights
🧠 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. Ignored Files
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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces the chanevents package, which provides functionality for monitoring and persisting channel events such as online/offline status and balance updates. The implementation includes a database Store with support for both SQLite and PostgreSQL backends, utilizing sqlc for type-safe query generation. Feedback primarily focuses on resolving inconsistencies between the SQL migration files and the generation script regarding the use of BIGINT for primary keys to match Go's int64. Additionally, there are suggestions to improve test configurability and to align the database check constraints with the application's EventType definitions.
409d90d to
6034fcd
Compare
ViktorT-11
left a comment
There was a problem hiding this comment.
Looks great, just leaving a few suggestions 🔥!
| require.NoError(t, err) | ||
| require.Equal(t, testChanPoint1, dbChannel.ChannelPoint) | ||
| require.Equal(t, testShortChanID1, dbChannel.ShortChannelID) | ||
| require.Equal(t, peerID, dbChannel.PeerID) |
There was a problem hiding this comment.
nit: could potentially create a channel comparison helper function instead.
There was a problem hiding this comment.
I skipped this, should we do more comparisons I'll add it, also for events.
6034fcd to
d2df787
Compare
0af6417
into
lightninglabs:faraday-forwarding-ability
Based on #235.
Implements tables to store channel events. Events can either be records of channels becoming on/offline, or updates of channel balances.