-
Notifications
You must be signed in to change notification settings - Fork 116
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
Add asset sell support to the RFQ service #835
Conversation
c37a1fd
to
cbc287a
Compare
There's local code |
08b298f
to
35e9ce6
Compare
I'm not sure how to setup the itest for the case where we sell a tap asset as the payment to satisfy the first hop in a lightning payment route. Alice wants to pay Carol. Carol generates the invoice. Alice wants to sell a tap asset to Bob, and Alice would like Bob to send the bid payment in that sale to Carol. In so doing Bob would satisfy the invoice that Carol generated for Alice. I can currently:
Bob can use his RFQ service to listen for a HTLC from Alice that satisfies the agreed Alice sale quote. And Alice can create a custom route with an input amount of 0 to Bob, but then stipulate that Bob must pay Carol the balance agreed upon in Alice-Bob's sale quote. Is that the way forward? @guggero ? |
There are important parts missing on the |
@guggero In the asset buy payment initiation case the HTLC intercepting node uses the SCID to identify the relevant HTLC. Both peers are aware of the SCID as it is present in the accepted quote (SCID is derived from message ID). Why do we need custom records? Can't we just forward a HTLC over the accepted quote SCID? |
746b5af
to
d2bc336
Compare
Oh, you're right, we have the |
d2bc336
to
a9a93fe
Compare
I've managed to get the custom records method to work with a custom route. But I didn't manage to forward a HTLC when I set |
I wander if the itest error is because of some side effect from the other RFQ itest. Passes locally for me. The first 10 commits can be split out into a separate PR. They are effectively refactor commits. |
a9a93fe
to
4c382c4
Compare
itests are failing when running together |
@ffranr will split out PRs to get merge faster |
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.
Looks pretty good, very nice work 🎉
Just a few minor comments
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.
Looks good, a few Qs
very nice commit structure
560845d
to
611353a
Compare
This commit adds an RPC endpoint for uploading an asset sell order to the RFQ service manager. This asset sell order will be converted into a sell request (or multiple) by the RFQ service negotiator.
Up until this commit in the PR, we've constructed sell request messages and have sent them to our peer (outgoing). In this commit we start modifying the RFQ service such that it can also receive those sell request messages from peers.
We will use this new type in a subsequent commit where we respond to an incoming sell request message.
In this commit we enhance the RFQ service such that the manager directs an incoming (from a peer) asset sell quote request message to the RFQ negotiator sub-service. The negotiator then populates the outgoing messages channel with a sell request accept message. This message will eventually be forwarded to the peer by the streamer RFQ sub-service.
This commit adds a new policy type to the order handler RFQ service. The new policy type is specific to asset purchases (where the counterparty has requested to sell an asset to our node). With this new type we can check that a HTLC is valid in the context of an asset purchase specifically. In this commit we ensure that before an asset sell quote request accept message is sent to our peer, the RFQ order handler registers a new asset purchase policy.
In this commit, we enable parsing of sell quote request accept messages from wire messages. We also store incoming (sent from our peer) asset sell quote request messages in the RFQ manager.
In this commit we add a new RFQ event type `PeerAcceptedSellQuoteEvent`. This event is published to RFQ event subscribers when the RFQ service receives an asset sell quote request accept message from a peer.
In this commit we extend RPC endpoint `QueryPeerAcceptedQuotes` such that it returns peer accepted sell quotes in addition to the existing peer accepted buy quotes. This change also includes expanding the RFQ manager `QueryPeerAcceptedQuotes` method return values.
The goal of this commit is to simplify troubleshooting LND node management.
The RFQ test scenario generates new LND nodes. In this commit we modify the test scenario cleanup routine to ensure that those nodes are killed at the end of each test.
611353a
to
ba506bc
Compare
Some of the review comments also apply to existing code that the PR doesn't touch. I've made a note of them and I'll create another PR address those code changes. |
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.
Great work! LGTM pending unit tests for encode/decode of messages.
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.
Looks good!
are the encode/decode unit tests landing in a diff PR?
otherwise lgtm
@GeorgeTsagk thanks for taking a second look. I've added these unit tests for encode/decode in this PR: |
Closes #818
This PR builds on top of the refactoring work from #814 .
It adds asset sell request and sell request accept support to the RFQ service.