taproot-assets icon indicating copy to clipboard operation
taproot-assets copied to clipboard

[feature]: Persist agreed quotes in RFQ service

Open ffranr opened this issue 11 months ago • 0 comments

Objective: Improve the RFQ (Request for Quote) service by enabling it to persist agreed quotes with peers as asset sale/purchase policies in an SQL table, and populate its state from this table upon startup.

Background:

  • Current Behavior: The RFQ service facilitates the exchange of quotes between peers but does not persist agreed quotes for future reference or state initialization.
  • Proposed Enhancement: Once a quote is agreed upon with a peer, it is represented in the "order handler" RFQ sub-service as an asset sale/purchase policy. This policy should then be written to an SQL table for persistence. Furthermore, upon startup, the RFQ service should read from this SQL table to populate its state/local cache.

Benefits:

  • Audit and Verification: Persistent storage of agreed quotes as policies in an SQL database will facilitate auditing and verification processes. We currently delete expired quotes without record keeping, persistence will provide a record of those quotes.
  • Service Reliability and Usability: By populating the RFQ service's state from the SQL table on startup, the service can ensure continuity and reliability after reboot, enhancing overall usability.

Implementation Considerations:

  • SQL Table Design: Design the SQL table schema to efficiently store asset sale/purchase policies, including fields for quote details, agreement timestamps, and identifiers of the agreeing parties.
  • Data Persistence Mechanism: Implement functionality in the "order handler" sub-service to write to and read from the SQL table via a quote "store".
  • Startup Procedure: Modify the RFQ service startup sequence to include reading from the SQL table and populating the service's local cache or state with the stored policies.

ffranr avatar Mar 25 '24 14:03 ffranr