Skip to content

rfq+tapdb: persist peer-accepted sell quotes#2051

Open
jtobin wants to merge 4 commits intolightninglabs:mainfrom
jtobin:persist-sell
Open

rfq+tapdb: persist peer-accepted sell quotes#2051
jtobin wants to merge 4 commits intolightninglabs:mainfrom
jtobin:persist-sell

Conversation

@jtobin
Copy link
Copy Markdown
Member

@jtobin jtobin commented Apr 6, 2026

Partially addresses #2003 (together with the peer-accepted buy quote persistence that was added in #2009, this fully resolves "gap 3").

Persists peer-accepted sell quotes to the database. Quotes are now written to the rfq_policies table on acceptance and restored into the in-memory cache on restart, mirroring our existing practice for buy-side persistence.

jtobin added 4 commits April 6, 2026 15:33
Expand the rfq_policies CHECK constraint to allow a fourth policy
type, RFQ_POLICY_TYPE_PEER_ACCEPTED_SELL, and bump
LatestMigrationVersion to 55. This follows the same
table-recreation pattern used in migration 053 for peer-accepted
buy quotes.
FetchAcceptedQuotes

Add the RfqPolicyTypeAssetPeerAcceptedSell constant and the
StorePeerAcceptedSellQuote method to the PolicyStore interface
and its PersistedPolicyStore implementation. Update
FetchAcceptedQuotes to return a fourth slice containing
peer-accepted sell quotes.
Persist peer-accepted sell quotes to the DB on acceptance in the
SellAccept handler, and restore them into the peerSellQuotes
cache on startup. Update mock PolicyStores and add DB-level
round-trip tests for the new policy type.
@jtobin jtobin self-assigned this Apr 6, 2026
@jtobin jtobin added database RFQ Work relating to TAP channel Request For Quote (RFQ). labels Apr 6, 2026
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, 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 completes the persistence requirements for RFQ (Request for Quote) policies by adding support for peer-accepted sell quotes. By persisting these quotes to the database, the system ensures that sell-side payment flows remain consistent and survive application restarts, effectively resolving the remaining work for "gap 3".

Highlights

  • Persistence of Peer-Accepted Sell Quotes: Implemented persistence for peer-accepted sell quotes in the database, ensuring they are restored into the in-memory cache upon application restart.
  • Database Schema Update: Updated the database schema (migration 55) to include the new policy type 'RFQ_POLICY_TYPE_PEER_ACCEPTED_SELL' in the rfq_policies table.
  • API and Interface Changes: Updated the PolicyStore interface and implementation to support storing and fetching the new peer-accepted sell quote type.

🧠 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.

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.

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
Copy Markdown

@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 implements the persistence of peer-accepted sell quotes to the database, ensuring that sell-side payment flows survive restarts by being restored into the active cache on startup. The changes include an update to the PolicyStore interface, a new database migration (version 55), and logic in the Manager and OrderHandler to handle the storage and restoration of these quotes. Feedback was provided to use structured logging for error messages in rfq/manager.go to align with the repository's style guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

database RFQ Work relating to TAP channel Request For Quote (RFQ).

Projects

Status: 🆕 New

Development

Successfully merging this pull request may close these issues.

[feature]: RFQ Persistence Analysis Report: Current Durable State, Ephemeral State, and Gaps

1 participant