Skip to content

Commit 46ab13c

Browse files
committed
rfq: improve BuyRequest doc
Improve doc by relating this type to the wider lightning payment flow context.
1 parent 5e03af2 commit 46ab13c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

rfqmsg/buy_request.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,23 @@ const (
1919
)
2020

2121
// BuyRequest is a struct that represents an asset buy quote request.
22+
//
23+
// Normal usage of a buy request:
24+
// 1. Alice, operating a wallet node, wants to receive a Tap asset as payment
25+
// by issuing a Lightning invoice.
26+
// 2. Alice has an asset channel established with Bob's edge node.
27+
// 3. Before issuing the invoice, Alice needs to agree on an exchange rate with
28+
// Bob, who will facilitate the asset transfer.
29+
// 4. To obtain the best exchange rate, Alice creates a buy order specifying
30+
// the desired asset.
31+
// 5. Alice's RFQ subsystem processes the buy order and sends buy requests to
32+
// relevant peers to find the best rate. In this example, Bob is the only
33+
// available peer.
34+
// 6. Once Bob provides a satisfactory quote, Alice accepts it.
35+
// 7. Alice issues the Lightning invoice, which Charlie will pay.
36+
// 8. Instead of paying Alice directly, Charlie pays Bob.
37+
// 9. Bob then forwards the agreed amount of the Tap asset to Alice over their
38+
// asset channel.
2239
type BuyRequest struct {
2340
// Peer is the peer that sent the quote request.
2441
Peer route.Vertex

0 commit comments

Comments
 (0)