-
Notifications
You must be signed in to change notification settings - Fork 137
Persist agreed quotes in RFQ service #1863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 0-8-0-staging
Are you sure you want to change the base?
Conversation
3c33ca3 to
f0acc02
Compare
Pull Request Test Coverage Report for Build 19360530476Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 19038516198Details
💛 - Coveralls |
98bcb62 to
5a2bd52
Compare
5a2bd52 to
f7ebd34
Compare
f7ebd34 to
703a103
Compare
e74f4ab to
497b820
Compare
2b3ac4f to
035a840
Compare
Adds a new rfq_policies table and store allowing persistence of sale and purchase policies.
497b820 to
7beb886
Compare
GeorgeTsagk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few nits, will do a final pass soon
| @@ -0,0 +1,20 @@ | |||
| package rfq | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: file should be named policy_store.go
|
|
||
| // cleanupStalePolicies removes expired policies from the local cache. | ||
| func (h *OrderHandler) cleanupStalePolicies() { | ||
| func (h *OrderHandler) cleanupStalePolicies() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you only seem to return nil here, why not remove error?
GeorgeTsagk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, dropped a few more comments
| // lightning node. | ||
| scid := msg.ShortChannelId() | ||
| m.peerAcceptedBuyQuotes.Store(scid, msg) | ||
| m.orderHandler.peerAcceptedBuyQuotes.Store(scid, msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we moving the maps to orderHandler if we end up calling them again from rfq.Manager?
| peerAcceptedBuyQuotes: lnutils.SyncMap[ | ||
| SerialisedScid, rfqmsg.BuyAccept]{}, | ||
| peerAcceptedSellQuotes: lnutils.SyncMap[ | ||
| SerialisedScid, rfqmsg.SellAccept]{}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we not initializing localAcceptedBuyQuotes / localAcceptedSellQuotes ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually I think the lnutils.SyncMap type doesn't need to be initialized, in that case should remove above lines
|
|
||
| err := h.cleanupStalePolicies() | ||
| if err != nil { | ||
| log.Errorf("error in main event loop: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: line break after log
| sqlc.InsertRfqPolicyParams) (int64, error) | ||
|
|
||
| FetchActiveRfqPolicies(context.Context) ( | ||
| []sqlc.RfqPolicy, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fits in one line
RFQ buy/sell accepts are now written to the database (
rfq_policiestable) whenever a policy is agreed, giving us an audit trail and keeping quotes across restarts.The
OrderHandlerreloads these rows at startup to rebuild policies and the manager repopulates its in-memory caches from the same data.Added a check in
itestthat restarts Bob’stapdmid RFQ flow and verifies the quote remains available to Carol.Fixes #855